diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..1492202b4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.env.example b/.env.example index 668c06f02..46fd5e08c 100644 --- a/.env.example +++ b/.env.example @@ -1,33 +1,54 @@ -APP_NAME=Laravel +APP_DEMO=false +APP_NAME=ssrpanel APP_ENV=local APP_KEY= -APP_DEBUG=true -APP_LOG_LEVEL=debug +APP_DEBUG=false APP_URL=http://localhost +APP_TIMEZONE=Asia/Shanghai +APP_LOCALE=zh-CN +APP_FALLBACK_LOCALE=en +LOG_CHANNEL=daily DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret +DB_DATABASE=ssrpanel +DB_USERNAME=root +DB_PASSWORD=root +DB_STRICT=false BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file -QUEUE_DRIVER=sync +SESSION_LIFETIME=120 +QUEUE_DRIVER=database REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST=smtp.mailtrap.io -MAIL_PORT=2525 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null +MAIL_HOST=smtp.exmail.qq.com +MAIL_PORT=465 +MAIL_USERNAME=admin@ssrpanel.com +MAIL_PASSWORD=password +MAIL_ENCRYPTION=ssl +MAIL_FROM_ADDRESS=admin@ssrpanel.com +MAIL_FROM_NAME=SSRPanel +MAILGUN_DOMAIN= +MAILGUN_SECRET= PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= +PUSHER_APP_CLUSTER=mt1 + +MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +REDIRECT_HTTPS=false + +GEETEST_ID= +GEETEST_KEY = +NOCAPTCHA_SECRET= +NOCAPTCHA_SITEKEY= diff --git a/.gitattributes b/.gitattributes index 967315dd3..39c735434 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ -* text=auto -*.css linguist-vendored -*.scss linguist-vendored -*.js linguist-vendored +*.js linguist-language=php +*.css linguist-language=php +*.scss linguist-language=php +*.html linguist-language=php CHANGELOG.md export-ignore diff --git a/.gitignore b/.gitignore index 4476d4d0d..8b9d6010c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,22 @@ /node_modules -/public/hot +/public/upload /public/storage -/storage/*.key -/storage/framework +/public/hot +/storage/framework/cache +/storage/framework/sessions +/storage/framework/views /storage/logs +/storage/app/public +/storage/*.key /vendor /.idea /.vagrant +/.vscode Homestead.json Homestead.yaml npm-debug.log +.DS_Store +.phpstorm.meta.php +yarn-error.log .env +.phpunit.result.cache diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..ecdd40d37 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-2019 Bruskyii Panda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/_ide_helper.php b/_ide_helper.php index d54d4fa84..93bf2fd45 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -1,17 +1,23 @@ * @see https://github.com/barryvdh/laravel-ide-helper */ -namespace { - exit("This file should not be included, only analyzed by your IDE"); -} namespace Illuminate\Support\Facades { + /** + * + * + * @see \Illuminate\Foundation\Application + */ class App { /** @@ -22,7 +28,8 @@ class App { */ public static function version() { - return \Illuminate\Foundation\Application::version(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->version(); } /** @@ -34,7 +41,8 @@ public static function version() */ public static function bootstrapWith($bootstrappers) { - \Illuminate\Foundation\Application::bootstrapWith($bootstrappers); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->bootstrapWith($bootstrappers); } /** @@ -46,7 +54,8 @@ public static function bootstrapWith($bootstrappers) */ public static function afterLoadingEnvironment($callback) { - \Illuminate\Foundation\Application::afterLoadingEnvironment($callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->afterLoadingEnvironment($callback); } /** @@ -59,7 +68,8 @@ public static function afterLoadingEnvironment($callback) */ public static function beforeBootstrapping($bootstrapper, $callback) { - \Illuminate\Foundation\Application::beforeBootstrapping($bootstrapper, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->beforeBootstrapping($bootstrapper, $callback); } /** @@ -72,7 +82,8 @@ public static function beforeBootstrapping($bootstrapper, $callback) */ public static function afterBootstrapping($bootstrapper, $callback) { - \Illuminate\Foundation\Application::afterBootstrapping($bootstrapper, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->afterBootstrapping($bootstrapper, $callback); } /** @@ -83,19 +94,21 @@ public static function afterBootstrapping($bootstrapper, $callback) */ public static function hasBeenBootstrapped() { - return \Illuminate\Foundation\Application::hasBeenBootstrapped(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->hasBeenBootstrapped(); } /** * Set the base path for the application. * * @param string $basePath - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function setBasePath($basePath) { - return \Illuminate\Foundation\Application::setBasePath($basePath); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->setBasePath($basePath); } /** @@ -107,7 +120,8 @@ public static function setBasePath($basePath) */ public static function path($path = '') { - return \Illuminate\Foundation\Application::path($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->path($path); } /** @@ -119,7 +133,8 @@ public static function path($path = '') */ public static function basePath($path = '') { - return \Illuminate\Foundation\Application::basePath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->basePath($path); } /** @@ -131,7 +146,8 @@ public static function basePath($path = '') */ public static function bootstrapPath($path = '') { - return \Illuminate\Foundation\Application::bootstrapPath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->bootstrapPath($path); } /** @@ -143,7 +159,8 @@ public static function bootstrapPath($path = '') */ public static function configPath($path = '') { - return \Illuminate\Foundation\Application::configPath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->configPath($path); } /** @@ -155,19 +172,21 @@ public static function configPath($path = '') */ public static function databasePath($path = '') { - return \Illuminate\Foundation\Application::databasePath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->databasePath($path); } /** * Set the database directory. * * @param string $path - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function useDatabasePath($path) { - return \Illuminate\Foundation\Application::useDatabasePath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->useDatabasePath($path); } /** @@ -178,7 +197,8 @@ public static function useDatabasePath($path) */ public static function langPath() { - return \Illuminate\Foundation\Application::langPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->langPath(); } /** @@ -189,7 +209,8 @@ public static function langPath() */ public static function publicPath() { - return \Illuminate\Foundation\Application::publicPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->publicPath(); } /** @@ -200,19 +221,21 @@ public static function publicPath() */ public static function storagePath() { - return \Illuminate\Foundation\Application::storagePath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->storagePath(); } /** * Set the storage directory. * * @param string $path - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function useStoragePath($path) { - return \Illuminate\Foundation\Application::useStoragePath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->useStoragePath($path); } /** @@ -224,7 +247,8 @@ public static function useStoragePath($path) */ public static function resourcePath($path = '') { - return \Illuminate\Foundation\Application::resourcePath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->resourcePath($path); } /** @@ -235,31 +259,34 @@ public static function resourcePath($path = '') */ public static function environmentPath() { - return \Illuminate\Foundation\Application::environmentPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->environmentPath(); } /** * Set the directory for the environment file. * * @param string $path - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function useEnvironmentPath($path) { - return \Illuminate\Foundation\Application::useEnvironmentPath($path); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->useEnvironmentPath($path); } /** * Set the environment file to be loaded during bootstrapping. * * @param string $file - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function loadEnvironmentFrom($file) { - return \Illuminate\Foundation\Application::loadEnvironmentFrom($file); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->loadEnvironmentFrom($file); } /** @@ -270,7 +297,8 @@ public static function loadEnvironmentFrom($file) */ public static function environmentFile() { - return \Illuminate\Foundation\Application::environmentFile(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->environmentFile(); } /** @@ -281,7 +309,8 @@ public static function environmentFile() */ public static function environmentFilePath() { - return \Illuminate\Foundation\Application::environmentFilePath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->environmentFilePath(); } /** @@ -292,7 +321,8 @@ public static function environmentFilePath() */ public static function environment() { - return \Illuminate\Foundation\Application::environment(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->environment(); } /** @@ -303,7 +333,8 @@ public static function environment() */ public static function isLocal() { - return \Illuminate\Foundation\Application::isLocal(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isLocal(); } /** @@ -315,29 +346,32 @@ public static function isLocal() */ public static function detectEnvironment($callback) { - return \Illuminate\Foundation\Application::detectEnvironment($callback); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->detectEnvironment($callback); } /** - * Determine if we are running in the console. + * Determine if the application is running in the console. * * @return bool * @static */ public static function runningInConsole() { - return \Illuminate\Foundation\Application::runningInConsole(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->runningInConsole(); } /** - * Determine if we are running unit tests. + * Determine if the application is running unit tests. * * @return bool * @static */ public static function runningUnitTests() { - return \Illuminate\Foundation\Application::runningUnitTests(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->runningUnitTests(); } /** @@ -348,7 +382,8 @@ public static function runningUnitTests() */ public static function registerConfiguredProviders() { - \Illuminate\Foundation\Application::registerConfiguredProviders(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->registerConfiguredProviders(); } /** @@ -362,7 +397,8 @@ public static function registerConfiguredProviders() */ public static function register($provider, $options = array(), $force = false) { - return \Illuminate\Foundation\Application::register($provider, $options, $force); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->register($provider, $options, $force); } /** @@ -374,7 +410,21 @@ public static function register($provider, $options = array(), $force = false) */ public static function getProvider($provider) { - return \Illuminate\Foundation\Application::getProvider($provider); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getProvider($provider); + } + + /** + * Get the registered service provider instances if any exist. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return array + * @static + */ + public static function getProviders($provider) + { + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getProviders($provider); } /** @@ -386,7 +436,8 @@ public static function getProvider($provider) */ public static function resolveProvider($provider) { - return \Illuminate\Foundation\Application::resolveProvider($provider); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->resolveProvider($provider); } /** @@ -397,7 +448,8 @@ public static function resolveProvider($provider) */ public static function loadDeferredProviders() { - \Illuminate\Foundation\Application::loadDeferredProviders(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->loadDeferredProviders(); } /** @@ -409,35 +461,22 @@ public static function loadDeferredProviders() */ public static function loadDeferredProvider($service) { - \Illuminate\Foundation\Application::loadDeferredProvider($service); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->loadDeferredProvider($service); } /** * Register a deferred provider and service. * * @param string $provider - * @param string $service + * @param string|null $service * @return void * @static */ public static function registerDeferredProvider($provider, $service = null) { - \Illuminate\Foundation\Application::registerDeferredProvider($provider, $service); - } - - /** - * Resolve the given type from the container. - * - * (Overriding Container::makeWith) - * - * @param string $abstract - * @param array $parameters - * @return mixed - * @static - */ - public static function makeWith($abstract, $parameters) - { - return \Illuminate\Foundation\Application::makeWith($abstract, $parameters); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->registerDeferredProvider($provider, $service); } /** @@ -446,12 +485,14 @@ public static function makeWith($abstract, $parameters) * (Overriding Container::make) * * @param string $abstract + * @param array $parameters * @return mixed * @static */ - public static function make($abstract) + public static function make($abstract, $parameters = array()) { - return \Illuminate\Foundation\Application::make($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->make($abstract, $parameters); } /** @@ -465,7 +506,8 @@ public static function make($abstract) */ public static function bound($abstract) { - return \Illuminate\Foundation\Application::bound($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->bound($abstract); } /** @@ -476,7 +518,8 @@ public static function bound($abstract) */ public static function isBooted() { - return \Illuminate\Foundation\Application::isBooted(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isBooted(); } /** @@ -487,7 +530,8 @@ public static function isBooted() */ public static function boot() { - \Illuminate\Foundation\Application::boot(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->boot(); } /** @@ -499,7 +543,8 @@ public static function boot() */ public static function booting($callback) { - \Illuminate\Foundation\Application::booting($callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->booting($callback); } /** @@ -511,7 +556,8 @@ public static function booting($callback) */ public static function booted($callback) { - \Illuminate\Foundation\Application::booted($callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->booted($callback); } /** @@ -521,7 +567,8 @@ public static function booted($callback) */ public static function handle($request, $type = 1, $catch = true) { - return \Illuminate\Foundation\Application::handle($request, $type, $catch); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->handle($request, $type, $catch); } /** @@ -532,7 +579,8 @@ public static function handle($request, $type = 1, $catch = true) */ public static function shouldSkipMiddleware() { - return \Illuminate\Foundation\Application::shouldSkipMiddleware(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->shouldSkipMiddleware(); } /** @@ -543,7 +591,20 @@ public static function shouldSkipMiddleware() */ public static function getCachedServicesPath() { - return \Illuminate\Foundation\Application::getCachedServicesPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getCachedServicesPath(); + } + + /** + * Get the path to the cached packages.php file. + * + * @return string + * @static + */ + public static function getCachedPackagesPath() + { + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getCachedPackagesPath(); } /** @@ -554,7 +615,8 @@ public static function getCachedServicesPath() */ public static function configurationIsCached() { - return \Illuminate\Foundation\Application::configurationIsCached(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->configurationIsCached(); } /** @@ -565,7 +627,8 @@ public static function configurationIsCached() */ public static function getCachedConfigPath() { - return \Illuminate\Foundation\Application::getCachedConfigPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getCachedConfigPath(); } /** @@ -576,7 +639,8 @@ public static function getCachedConfigPath() */ public static function routesAreCached() { - return \Illuminate\Foundation\Application::routesAreCached(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->routesAreCached(); } /** @@ -587,7 +651,8 @@ public static function routesAreCached() */ public static function getCachedRoutesPath() { - return \Illuminate\Foundation\Application::getCachedRoutesPath(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getCachedRoutesPath(); } /** @@ -598,7 +663,8 @@ public static function getCachedRoutesPath() */ public static function isDownForMaintenance() { - return \Illuminate\Foundation\Application::isDownForMaintenance(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isDownForMaintenance(); } /** @@ -613,19 +679,21 @@ public static function isDownForMaintenance() */ public static function abort($code, $message = '', $headers = array()) { - \Illuminate\Foundation\Application::abort($code, $message, $headers); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->abort($code, $message, $headers); } /** * Register a terminating callback with the application. * * @param \Closure $callback - * @return $this + * @return \Illuminate\Foundation\Application * @static */ public static function terminating($callback) { - return \Illuminate\Foundation\Application::terminating($callback); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->terminating($callback); } /** @@ -636,7 +704,8 @@ public static function terminating($callback) */ public static function terminate() { - \Illuminate\Foundation\Application::terminate(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->terminate(); } /** @@ -647,7 +716,8 @@ public static function terminate() */ public static function getLoadedProviders() { - return \Illuminate\Foundation\Application::getLoadedProviders(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getLoadedProviders(); } /** @@ -658,7 +728,8 @@ public static function getLoadedProviders() */ public static function getDeferredServices() { - return \Illuminate\Foundation\Application::getDeferredServices(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getDeferredServices(); } /** @@ -670,7 +741,8 @@ public static function getDeferredServices() */ public static function setDeferredServices($services) { - \Illuminate\Foundation\Application::setDeferredServices($services); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->setDeferredServices($services); } /** @@ -682,7 +754,8 @@ public static function setDeferredServices($services) */ public static function addDeferredServices($services) { - \Illuminate\Foundation\Application::addDeferredServices($services); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->addDeferredServices($services); } /** @@ -694,7 +767,8 @@ public static function addDeferredServices($services) */ public static function isDeferredService($service) { - return \Illuminate\Foundation\Application::isDeferredService($service); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isDeferredService($service); } /** @@ -706,41 +780,8 @@ public static function isDeferredService($service) */ public static function provideFacades($namespace) { - \Illuminate\Foundation\Application::provideFacades($namespace); - } - - /** - * Define a callback to be used to configure Monolog. - * - * @param callable $callback - * @return $this - * @static - */ - public static function configureMonologUsing($callback) - { - return \Illuminate\Foundation\Application::configureMonologUsing($callback); - } - - /** - * Determine if the application has a custom Monolog configurator. - * - * @return bool - * @static - */ - public static function hasMonologConfigurator() - { - return \Illuminate\Foundation\Application::hasMonologConfigurator(); - } - - /** - * Get the custom Monolog configurator for the application. - * - * @return callable - * @static - */ - public static function getMonologConfigurator() - { - return \Illuminate\Foundation\Application::getMonologConfigurator(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->provideFacades($namespace); } /** @@ -751,7 +792,8 @@ public static function getMonologConfigurator() */ public static function getLocale() { - return \Illuminate\Foundation\Application::getLocale(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getLocale(); } /** @@ -763,7 +805,8 @@ public static function getLocale() */ public static function setLocale($locale) { - \Illuminate\Foundation\Application::setLocale($locale); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->setLocale($locale); } /** @@ -775,7 +818,8 @@ public static function setLocale($locale) */ public static function isLocale($locale) { - return \Illuminate\Foundation\Application::isLocale($locale); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isLocale($locale); } /** @@ -786,7 +830,8 @@ public static function isLocale($locale) */ public static function registerCoreContainerAliases() { - \Illuminate\Foundation\Application::registerCoreContainerAliases(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->registerCoreContainerAliases(); } /** @@ -797,7 +842,8 @@ public static function registerCoreContainerAliases() */ public static function flush() { - \Illuminate\Foundation\Application::flush(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->flush(); } /** @@ -809,7 +855,8 @@ public static function flush() */ public static function getNamespace() { - return \Illuminate\Foundation\Application::getNamespace(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getNamespace(); } /** @@ -822,7 +869,27 @@ public static function getNamespace() public static function when($concrete) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::when($concrete); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->when($concrete); + } + + /** + * Returns true if the container can return an entry for the given identifier. + * + * Returns false otherwise. + * + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. + * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. + * + * @param string $id Identifier of the entry to look for. + * @return bool + * @static + */ + public static function has($id) + { + //Method inherited from \Illuminate\Container\Container + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->has($id); } /** @@ -835,7 +902,8 @@ public static function when($concrete) public static function resolved($abstract) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::resolved($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->resolved($abstract); } /** @@ -848,7 +916,8 @@ public static function resolved($abstract) public static function isShared($abstract) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::isShared($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isShared($abstract); } /** @@ -861,13 +930,14 @@ public static function isShared($abstract) public static function isAlias($name) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::isAlias($name); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->isAlias($name); } /** * Register a binding with the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @param bool $shared * @return void @@ -876,7 +946,8 @@ public static function isAlias($name) public static function bind($abstract, $concrete = null, $shared = false) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::bind($abstract, $concrete, $shared); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->bind($abstract, $concrete, $shared); } /** @@ -889,13 +960,14 @@ public static function bind($abstract, $concrete = null, $shared = false) public static function hasMethodBinding($method) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::hasMethodBinding($method); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->hasMethodBinding($method); } /** * Bind a callback to resolve with Container::call. * - * @param string $method + * @param array|string $method * @param \Closure $callback * @return void * @static @@ -903,7 +975,8 @@ public static function hasMethodBinding($method) public static function bindMethod($method, $callback) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::bindMethod($method, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->bindMethod($method, $callback); } /** @@ -917,7 +990,8 @@ public static function bindMethod($method, $callback) public static function callMethodBinding($method, $instance) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::callMethodBinding($method, $instance); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->callMethodBinding($method, $instance); } /** @@ -932,7 +1006,8 @@ public static function callMethodBinding($method, $instance) public static function addContextualBinding($concrete, $abstract, $implementation) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::addContextualBinding($concrete, $abstract, $implementation); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->addContextualBinding($concrete, $abstract, $implementation); } /** @@ -947,13 +1022,14 @@ public static function addContextualBinding($concrete, $abstract, $implementatio public static function bindIf($abstract, $concrete = null, $shared = false) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::bindIf($abstract, $concrete, $shared); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->bindIf($abstract, $concrete, $shared); } /** * Register a shared binding in the container. * - * @param string|array $abstract + * @param string $abstract * @param \Closure|string|null $concrete * @return void * @static @@ -961,7 +1037,8 @@ public static function bindIf($abstract, $concrete = null, $shared = false) public static function singleton($abstract, $concrete = null) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::singleton($abstract, $concrete); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->singleton($abstract, $concrete); } /** @@ -976,7 +1053,8 @@ public static function singleton($abstract, $concrete = null) public static function extend($abstract, $closure) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::extend($abstract, $closure); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->extend($abstract, $closure); } /** @@ -984,13 +1062,14 @@ public static function extend($abstract, $closure) * * @param string $abstract * @param mixed $instance - * @return void + * @return mixed * @static */ public static function instance($abstract, $instance) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::instance($abstract, $instance); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->instance($abstract, $instance); } /** @@ -1004,7 +1083,8 @@ public static function instance($abstract, $instance) public static function tag($abstracts, $tags) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::tag($abstracts, $tags); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->tag($abstracts, $tags); } /** @@ -1017,7 +1097,8 @@ public static function tag($abstracts, $tags) public static function tagged($tag) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::tagged($tag); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->tagged($tag); } /** @@ -1031,7 +1112,8 @@ public static function tagged($tag) public static function alias($abstract, $alias) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::alias($abstract, $alias); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->alias($abstract, $alias); } /** @@ -1045,7 +1127,8 @@ public static function alias($abstract, $alias) public static function rebinding($abstract, $callback) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::rebinding($abstract, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->rebinding($abstract, $callback); } /** @@ -1060,7 +1143,8 @@ public static function rebinding($abstract, $callback) public static function refresh($abstract, $target, $method) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::refresh($abstract, $target, $method); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->refresh($abstract, $target, $method); } /** @@ -1074,7 +1158,8 @@ public static function refresh($abstract, $target, $method) public static function wrap($callback, $parameters = array()) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::wrap($callback, $parameters); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->wrap($callback, $parameters); } /** @@ -1089,7 +1174,8 @@ public static function wrap($callback, $parameters = array()) public static function call($callback, $parameters = array(), $defaultMethod = null) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::call($callback, $parameters, $defaultMethod); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->call($callback, $parameters, $defaultMethod); } /** @@ -1102,7 +1188,39 @@ public static function call($callback, $parameters = array(), $defaultMethod = n public static function factory($abstract) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::factory($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->factory($abstract); + } + + /** + * An alias function name for make(). + * + * @param string $abstract + * @param array $parameters + * @return mixed + * @static + */ + public static function makeWith($abstract, $parameters = array()) + { + //Method inherited from \Illuminate\Container\Container + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->makeWith($abstract, $parameters); + } + + /** + * Finds an entry of the container by its identifier and returns it. + * + * @param string $id Identifier of the entry to look for. + * @throws NotFoundExceptionInterface No entry was found for **this** identifier. + * @throws ContainerExceptionInterface Error while retrieving the entry. + * @return mixed Entry. + * @static + */ + public static function get($id) + { + //Method inherited from \Illuminate\Container\Container + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->get($id); } /** @@ -1116,13 +1234,14 @@ public static function factory($abstract) public static function build($concrete) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::build($concrete); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->build($concrete); } /** * Register a new resolving callback. * - * @param string $abstract + * @param \Closure|string $abstract * @param \Closure|null $callback * @return void * @static @@ -1130,13 +1249,14 @@ public static function build($concrete) public static function resolving($abstract, $callback = null) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::resolving($abstract, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->resolving($abstract, $callback); } /** * Register a new after resolving callback for all types. * - * @param string $abstract + * @param \Closure|string $abstract * @param \Closure|null $callback * @return void * @static @@ -1144,7 +1264,8 @@ public static function resolving($abstract, $callback = null) public static function afterResolving($abstract, $callback = null) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::afterResolving($abstract, $callback); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->afterResolving($abstract, $callback); } /** @@ -1156,7 +1277,8 @@ public static function afterResolving($abstract, $callback = null) public static function getBindings() { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::getBindings(); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getBindings(); } /** @@ -1170,7 +1292,8 @@ public static function getBindings() public static function getAlias($abstract) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::getAlias($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->getAlias($abstract); } /** @@ -1183,7 +1306,8 @@ public static function getAlias($abstract) public static function forgetExtenders($abstract) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::forgetExtenders($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->forgetExtenders($abstract); } /** @@ -1196,7 +1320,8 @@ public static function forgetExtenders($abstract) public static function forgetInstance($abstract) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::forgetInstance($abstract); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->forgetInstance($abstract); } /** @@ -1208,7 +1333,8 @@ public static function forgetInstance($abstract) public static function forgetInstances() { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::forgetInstances(); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->forgetInstances(); } /** @@ -1220,20 +1346,20 @@ public static function forgetInstances() public static function getInstance() { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::getInstance(); + return \Illuminate\Foundation\Application::getInstance(); } /** * Set the shared instance of the container. * * @param \Illuminate\Contracts\Container\Container|null $container - * @return static + * @return \Illuminate\Contracts\Container\Container|static * @static */ public static function setInstance($container = null) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::setInstance($container); + return \Illuminate\Foundation\Application::setInstance($container); } /** @@ -1246,7 +1372,8 @@ public static function setInstance($container = null) public static function offsetExists($key) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::offsetExists($key); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->offsetExists($key); } /** @@ -1259,7 +1386,8 @@ public static function offsetExists($key) public static function offsetGet($key) { //Method inherited from \Illuminate\Container\Container - return \Illuminate\Foundation\Application::offsetGet($key); + /** @var \Illuminate\Foundation\Application $instance */ + return $instance->offsetGet($key); } /** @@ -1273,7 +1401,8 @@ public static function offsetGet($key) public static function offsetSet($key, $value) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::offsetSet($key, $value); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->offsetSet($key, $value); } /** @@ -1286,11 +1415,17 @@ public static function offsetSet($key, $value) public static function offsetUnset($key) { //Method inherited from \Illuminate\Container\Container - \Illuminate\Foundation\Application::offsetUnset($key); + /** @var \Illuminate\Foundation\Application $instance */ + $instance->offsetUnset($key); } } + /** + * + * + * @see \Illuminate\Contracts\Console\Kernel + */ class Artisan { /** @@ -1304,7 +1439,8 @@ class Artisan { public static function handle($input, $output = null) { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::handle($input, $output); + /** @var \App\Console\Kernel $instance */ + return $instance->handle($input, $output); } /** @@ -1318,7 +1454,8 @@ public static function handle($input, $output = null) public static function terminate($input, $status) { //Method inherited from \Illuminate\Foundation\Console\Kernel - \App\Console\Kernel::terminate($input, $status); + /** @var \App\Console\Kernel $instance */ + $instance->terminate($input, $status); } /** @@ -1332,7 +1469,8 @@ public static function terminate($input, $status) public static function command($signature, $callback) { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::command($signature, $callback); + /** @var \App\Console\Kernel $instance */ + return $instance->command($signature, $callback); } /** @@ -1345,7 +1483,8 @@ public static function command($signature, $callback) public static function registerCommand($command) { //Method inherited from \Illuminate\Foundation\Console\Kernel - \App\Console\Kernel::registerCommand($command); + /** @var \App\Console\Kernel $instance */ + $instance->registerCommand($command); } /** @@ -1360,7 +1499,8 @@ public static function registerCommand($command) public static function call($command, $parameters = array(), $outputBuffer = null) { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::call($command, $parameters, $outputBuffer); + /** @var \App\Console\Kernel $instance */ + return $instance->call($command, $parameters, $outputBuffer); } /** @@ -1374,7 +1514,8 @@ public static function call($command, $parameters = array(), $outputBuffer = nul public static function queue($command, $parameters = array()) { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::queue($command, $parameters); + /** @var \App\Console\Kernel $instance */ + return $instance->queue($command, $parameters); } /** @@ -1386,7 +1527,8 @@ public static function queue($command, $parameters = array()) public static function all() { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::all(); + /** @var \App\Console\Kernel $instance */ + return $instance->all(); } /** @@ -1398,7 +1540,8 @@ public static function all() public static function output() { //Method inherited from \Illuminate\Foundation\Console\Kernel - return \App\Console\Kernel::output(); + /** @var \App\Console\Kernel $instance */ + return $instance->output(); } /** @@ -1410,7 +1553,8 @@ public static function output() public static function bootstrap() { //Method inherited from \Illuminate\Foundation\Console\Kernel - \App\Console\Kernel::bootstrap(); + /** @var \App\Console\Kernel $instance */ + $instance->bootstrap(); } /** @@ -1423,11 +1567,20 @@ public static function bootstrap() public static function setArtisan($artisan) { //Method inherited from \Illuminate\Foundation\Console\Kernel - \App\Console\Kernel::setArtisan($artisan); + /** @var \App\Console\Kernel $instance */ + $instance->setArtisan($artisan); } } + /** + * + * + * @see \Illuminate\Auth\AuthManager + * @see \Illuminate\Contracts\Auth\Factory + * @see \Illuminate\Contracts\Auth\Guard + * @see \Illuminate\Contracts\Auth\StatefulGuard + */ class Auth { /** @@ -1439,7 +1592,8 @@ class Auth { */ public static function guard($name = null) { - return \Illuminate\Auth\AuthManager::guard($name); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->guard($name); } /** @@ -1452,7 +1606,8 @@ public static function guard($name = null) */ public static function createSessionDriver($name, $config) { - return \Illuminate\Auth\AuthManager::createSessionDriver($name, $config); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->createSessionDriver($name, $config); } /** @@ -1465,7 +1620,8 @@ public static function createSessionDriver($name, $config) */ public static function createTokenDriver($name, $config) { - return \Illuminate\Auth\AuthManager::createTokenDriver($name, $config); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->createTokenDriver($name, $config); } /** @@ -1476,7 +1632,8 @@ public static function createTokenDriver($name, $config) */ public static function getDefaultDriver() { - return \Illuminate\Auth\AuthManager::getDefaultDriver(); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -1488,7 +1645,8 @@ public static function getDefaultDriver() */ public static function shouldUse($name) { - \Illuminate\Auth\AuthManager::shouldUse($name); + /** @var \Illuminate\Auth\AuthManager $instance */ + $instance->shouldUse($name); } /** @@ -1500,7 +1658,8 @@ public static function shouldUse($name) */ public static function setDefaultDriver($name) { - \Illuminate\Auth\AuthManager::setDefaultDriver($name); + /** @var \Illuminate\Auth\AuthManager $instance */ + $instance->setDefaultDriver($name); } /** @@ -1508,12 +1667,13 @@ public static function setDefaultDriver($name) * * @param string $driver * @param callable $callback - * @return $this + * @return \Illuminate\Auth\AuthManager * @static */ public static function viaRequest($driver, $callback) { - return \Illuminate\Auth\AuthManager::viaRequest($driver, $callback); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->viaRequest($driver, $callback); } /** @@ -1524,19 +1684,21 @@ public static function viaRequest($driver, $callback) */ public static function userResolver() { - return \Illuminate\Auth\AuthManager::userResolver(); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->userResolver(); } /** * Set the callback to be used to resolve users. * * @param \Closure $userResolver - * @return $this + * @return \Illuminate\Auth\AuthManager * @static */ public static function resolveUsersUsing($userResolver) { - return \Illuminate\Auth\AuthManager::resolveUsersUsing($userResolver); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->resolveUsersUsing($userResolver); } /** @@ -1544,12 +1706,13 @@ public static function resolveUsersUsing($userResolver) * * @param string $driver * @param \Closure $callback - * @return $this + * @return \Illuminate\Auth\AuthManager * @static */ public static function extend($driver, $callback) { - return \Illuminate\Auth\AuthManager::extend($driver, $callback); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->extend($driver, $callback); } /** @@ -1557,36 +1720,51 @@ public static function extend($driver, $callback) * * @param string $name * @param \Closure $callback - * @return $this + * @return \Illuminate\Auth\AuthManager * @static */ public static function provider($name, $callback) { - return \Illuminate\Auth\AuthManager::provider($name, $callback); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->provider($name, $callback); } /** * Create the user provider implementation for the driver. * - * @param string $provider - * @return \Illuminate\Contracts\Auth\UserProvider + * @param string|null $provider + * @return \Illuminate\Contracts\Auth\UserProvider|null * @throws \InvalidArgumentException * @static */ - public static function createUserProvider($provider) + public static function createUserProvider($provider = null) + { + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->createUserProvider($provider); + } + + /** + * Get the default user provider name. + * + * @return string + * @static + */ + public static function getDefaultUserProvider() { - return \Illuminate\Auth\AuthManager::createUserProvider($provider); + /** @var \Illuminate\Auth\AuthManager $instance */ + return $instance->getDefaultUserProvider(); } /** * Get the currently authenticated user. * - * @return \App\User|null + * @return \App\Http\Models\User|null * @static */ public static function user() { - return \Illuminate\Auth\SessionGuard::user(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->user(); } /** @@ -1597,7 +1775,8 @@ public static function user() */ public static function id() { - return \Illuminate\Auth\SessionGuard::id(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->id(); } /** @@ -1609,19 +1788,21 @@ public static function id() */ public static function once($credentials = array()) { - return \Illuminate\Auth\SessionGuard::once($credentials); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->once($credentials); } /** * Log the given user ID into the application without sessions or cookies. * * @param mixed $id - * @return \App\User|false + * @return \App\Http\Models\User|false * @static */ public static function onceUsingId($id) { - return \Illuminate\Auth\SessionGuard::onceUsingId($id); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->onceUsingId($id); } /** @@ -1633,7 +1814,8 @@ public static function onceUsingId($id) */ public static function validate($credentials = array()) { - return \Illuminate\Auth\SessionGuard::validate($credentials); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->validate($credentials); } /** @@ -1646,7 +1828,8 @@ public static function validate($credentials = array()) */ public static function basic($field = 'email', $extraConditions = array()) { - return \Illuminate\Auth\SessionGuard::basic($field, $extraConditions); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->basic($field, $extraConditions); } /** @@ -1659,7 +1842,8 @@ public static function basic($field = 'email', $extraConditions = array()) */ public static function onceBasic($field = 'email', $extraConditions = array()) { - return \Illuminate\Auth\SessionGuard::onceBasic($field, $extraConditions); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->onceBasic($field, $extraConditions); } /** @@ -1672,7 +1856,8 @@ public static function onceBasic($field = 'email', $extraConditions = array()) */ public static function attempt($credentials = array(), $remember = false) { - return \Illuminate\Auth\SessionGuard::attempt($credentials, $remember); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->attempt($credentials, $remember); } /** @@ -1680,12 +1865,13 @@ public static function attempt($credentials = array(), $remember = false) * * @param mixed $id * @param bool $remember - * @return \App\User|false + * @return \App\Http\Models\User|false * @static */ public static function loginUsingId($id, $remember = false) { - return \Illuminate\Auth\SessionGuard::loginUsingId($id, $remember); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->loginUsingId($id, $remember); } /** @@ -1698,7 +1884,8 @@ public static function loginUsingId($id, $remember = false) */ public static function login($user, $remember = false) { - \Illuminate\Auth\SessionGuard::login($user, $remember); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->login($user, $remember); } /** @@ -1709,7 +1896,24 @@ public static function login($user, $remember = false) */ public static function logout() { - \Illuminate\Auth\SessionGuard::logout(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->logout(); + } + + /** + * Invalidate other sessions for the current user. + * + * The application must be using the AuthenticateSession middleware. + * + * @param string $password + * @param string $attribute + * @return bool|null + * @static + */ + public static function logoutOtherDevices($password, $attribute = 'password') + { + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->logoutOtherDevices($password, $attribute); } /** @@ -1721,18 +1925,20 @@ public static function logout() */ public static function attempting($callback) { - \Illuminate\Auth\SessionGuard::attempting($callback); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->attempting($callback); } /** * Get the last user we attempted to authenticate. * - * @return \App\User + * @return \App\Http\Models\User * @static */ public static function getLastAttempted() { - return \Illuminate\Auth\SessionGuard::getLastAttempted(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getLastAttempted(); } /** @@ -1743,7 +1949,8 @@ public static function getLastAttempted() */ public static function getName() { - return \Illuminate\Auth\SessionGuard::getName(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getName(); } /** @@ -1754,7 +1961,8 @@ public static function getName() */ public static function getRecallerName() { - return \Illuminate\Auth\SessionGuard::getRecallerName(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getRecallerName(); } /** @@ -1765,7 +1973,8 @@ public static function getRecallerName() */ public static function viaRemember() { - return \Illuminate\Auth\SessionGuard::viaRemember(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->viaRemember(); } /** @@ -1777,7 +1986,8 @@ public static function viaRemember() */ public static function getCookieJar() { - return \Illuminate\Auth\SessionGuard::getCookieJar(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getCookieJar(); } /** @@ -1789,7 +1999,8 @@ public static function getCookieJar() */ public static function setCookieJar($cookie) { - \Illuminate\Auth\SessionGuard::setCookieJar($cookie); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->setCookieJar($cookie); } /** @@ -1800,7 +2011,8 @@ public static function setCookieJar($cookie) */ public static function getDispatcher() { - return \Illuminate\Auth\SessionGuard::getDispatcher(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getDispatcher(); } /** @@ -1812,87 +2024,95 @@ public static function getDispatcher() */ public static function setDispatcher($events) { - \Illuminate\Auth\SessionGuard::setDispatcher($events); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->setDispatcher($events); } /** * Get the session store used by the guard. * - * @return \Illuminate\Session\Store + * @return \Illuminate\Contracts\Session\Session * @static */ public static function getSession() { - return \Illuminate\Auth\SessionGuard::getSession(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getSession(); } /** - * Get the user provider used by the guard. + * Return the currently cached user. * - * @return \Illuminate\Contracts\Auth\UserProvider + * @return \App\Http\Models\User|null * @static */ - public static function getProvider() + public static function getUser() { - return \Illuminate\Auth\SessionGuard::getProvider(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getUser(); } /** - * Set the user provider used by the guard. + * Set the current user. * - * @param \Illuminate\Contracts\Auth\UserProvider $provider - * @return void + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return \Illuminate\Auth\SessionGuard * @static */ - public static function setProvider($provider) + public static function setUser($user) { - \Illuminate\Auth\SessionGuard::setProvider($provider); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->setUser($user); } /** - * Return the currently cached user. + * Get the current request instance. * - * @return \App\User|null + * @return \Symfony\Component\HttpFoundation\Request * @static */ - public static function getUser() + public static function getRequest() { - return \Illuminate\Auth\SessionGuard::getUser(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getRequest(); } /** - * Set the current user. + * Set the current request instance. * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @return $this + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Illuminate\Auth\SessionGuard * @static */ - public static function setUser($user) + public static function setRequest($request) { - return \Illuminate\Auth\SessionGuard::setUser($user); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->setRequest($request); } /** - * Get the current request instance. + * Determine if the current user is authenticated. * - * @return \Symfony\Component\HttpFoundation\Request + * @return \App\Http\Models\User + * @throws \Illuminate\Auth\AuthenticationException * @static */ - public static function getRequest() + public static function authenticate() { - return \Illuminate\Auth\SessionGuard::getRequest(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->authenticate(); } /** - * Set the current request instance. + * Determine if the guard has a user instance. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return $this + * @return bool * @static */ - public static function setRequest($request) + public static function hasUser() { - return \Illuminate\Auth\SessionGuard::setRequest($request); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->hasUser(); } /** @@ -1903,7 +2123,8 @@ public static function setRequest($request) */ public static function check() { - return \Illuminate\Auth\SessionGuard::check(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->check(); } /** @@ -1914,32 +2135,59 @@ public static function check() */ public static function guest() { - return \Illuminate\Auth\SessionGuard::guest(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->guest(); } /** - * Determine if the current user is authenticated. + * Get the user provider used by the guard. * - * @return \App\User - * @throws \Illuminate\Auth\AuthenticationException + * @return \Illuminate\Contracts\Auth\UserProvider * @static */ - public static function authenticate() + public static function getProvider() + { + /** @var \Illuminate\Auth\SessionGuard $instance */ + return $instance->getProvider(); + } + + /** + * Set the user provider used by the guard. + * + * @param \Illuminate\Contracts\Auth\UserProvider $provider + * @return void + * @static + */ + public static function setProvider($provider) { - return \Illuminate\Auth\SessionGuard::authenticate(); + /** @var \Illuminate\Auth\SessionGuard $instance */ + $instance->setProvider($provider); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Auth\SessionGuard::macro($name, $macro); + \Illuminate\Auth\SessionGuard::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Auth\SessionGuard::mixin($mixin); } /** @@ -1951,11 +2199,16 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Auth\SessionGuard::hasMacro($name); + return \Illuminate\Auth\SessionGuard::hasMacro($name); } } + /** + * + * + * @see \Illuminate\View\Compilers\BladeCompiler + */ class Blade { /** @@ -1967,7 +2220,8 @@ class Blade { */ public static function compile($path = null) { - \Illuminate\View\Compilers\BladeCompiler::compile($path); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->compile($path); } /** @@ -1978,7 +2232,8 @@ public static function compile($path = null) */ public static function getPath() { - return \Illuminate\View\Compilers\BladeCompiler::getPath(); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->getPath(); } /** @@ -1990,7 +2245,8 @@ public static function getPath() */ public static function setPath($path) { - \Illuminate\View\Compilers\BladeCompiler::setPath($path); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->setPath($path); } /** @@ -2002,7 +2258,8 @@ public static function setPath($path) */ public static function compileString($value) { - return \Illuminate\View\Compilers\BladeCompiler::compileString($value); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->compileString($value); } /** @@ -2014,7 +2271,8 @@ public static function compileString($value) */ public static function stripParentheses($expression) { - return \Illuminate\View\Compilers\BladeCompiler::stripParentheses($expression); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->stripParentheses($expression); } /** @@ -2026,7 +2284,8 @@ public static function stripParentheses($expression) */ public static function extend($compiler) { - \Illuminate\View\Compilers\BladeCompiler::extend($compiler); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->extend($compiler); } /** @@ -2037,7 +2296,64 @@ public static function extend($compiler) */ public static function getExtensions() { - return \Illuminate\View\Compilers\BladeCompiler::getExtensions(); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->getExtensions(); + } + + /** + * Register an "if" statement directive. + * + * @param string $name + * @param callable $callback + * @return void + * @static + */ + public static function if($name, $callback) + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->if($name, $callback); + } + + /** + * Check the result of a condition. + * + * @param string $name + * @param array $parameters + * @return bool + * @static + */ + public static function check($name, $parameters = null) + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->check($name, $parameters); + } + + /** + * Register a component alias directive. + * + * @param string $path + * @param string $alias + * @return void + * @static + */ + public static function component($path, $alias = null) + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->component($path, $alias); + } + + /** + * Register an include alias directive. + * + * @param string $path + * @param string $alias + * @return void + * @static + */ + public static function include($path, $alias = null) + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->include($path, $alias); } /** @@ -2050,7 +2366,8 @@ public static function getExtensions() */ public static function directive($name, $handler) { - \Illuminate\View\Compilers\BladeCompiler::directive($name, $handler); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->directive($name, $handler); } /** @@ -2061,7 +2378,8 @@ public static function directive($name, $handler) */ public static function getCustomDirectives() { - return \Illuminate\View\Compilers\BladeCompiler::getCustomDirectives(); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->getCustomDirectives(); } /** @@ -2073,7 +2391,32 @@ public static function getCustomDirectives() */ public static function setEchoFormat($format) { - \Illuminate\View\Compilers\BladeCompiler::setEchoFormat($format); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->setEchoFormat($format); + } + + /** + * Set the "echo" format to double encode entities. + * + * @return void + * @static + */ + public static function withDoubleEncoding() + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->withDoubleEncoding(); + } + + /** + * Set the "echo" format to not double encode entities. + * + * @return void + * @static + */ + public static function withoutDoubleEncoding() + { + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + $instance->withoutDoubleEncoding(); } /** @@ -2086,7 +2429,8 @@ public static function setEchoFormat($format) public static function getCompiledPath($path) { //Method inherited from \Illuminate\View\Compilers\Compiler - return \Illuminate\View\Compilers\BladeCompiler::getCompiledPath($path); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->getCompiledPath($path); } /** @@ -2099,7 +2443,8 @@ public static function getCompiledPath($path) public static function isExpired($path) { //Method inherited from \Illuminate\View\Compilers\Compiler - return \Illuminate\View\Compilers\BladeCompiler::isExpired($path); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->isExpired($path); } /** @@ -2111,11 +2456,19 @@ public static function isExpired($path) */ public static function compileEchoDefaults($value) { - return \Illuminate\View\Compilers\BladeCompiler::compileEchoDefaults($value); + /** @var \Illuminate\View\Compilers\BladeCompiler $instance */ + return $instance->compileEchoDefaults($value); } } + /** + * + * + * @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback) + * @method static mixed auth(\Illuminate\Http\Request $request) + * @see \Illuminate\Contracts\Broadcasting\Factory + */ class Broadcast { /** @@ -2127,7 +2480,8 @@ class Broadcast { */ public static function routes($attributes = null) { - \Illuminate\Broadcasting\BroadcastManager::routes($attributes); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + $instance->routes($attributes); } /** @@ -2139,7 +2493,8 @@ public static function routes($attributes = null) */ public static function socket($request = null) { - return \Illuminate\Broadcasting\BroadcastManager::socket($request); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->socket($request); } /** @@ -2151,7 +2506,8 @@ public static function socket($request = null) */ public static function event($event = null) { - return \Illuminate\Broadcasting\BroadcastManager::event($event); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->event($event); } /** @@ -2163,7 +2519,8 @@ public static function event($event = null) */ public static function queue($event) { - \Illuminate\Broadcasting\BroadcastManager::queue($event); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + $instance->queue($event); } /** @@ -2175,19 +2532,21 @@ public static function queue($event) */ public static function connection($driver = null) { - return \Illuminate\Broadcasting\BroadcastManager::connection($driver); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->connection($driver); } /** * Get a driver instance. * - * @param string $name + * @param string|null $name * @return mixed * @static */ public static function driver($name = null) { - return \Illuminate\Broadcasting\BroadcastManager::driver($name); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->driver($name); } /** @@ -2198,7 +2557,8 @@ public static function driver($name = null) */ public static function getDefaultDriver() { - return \Illuminate\Broadcasting\BroadcastManager::getDefaultDriver(); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -2210,7 +2570,8 @@ public static function getDefaultDriver() */ public static function setDefaultDriver($name) { - \Illuminate\Broadcasting\BroadcastManager::setDefaultDriver($name); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + $instance->setDefaultDriver($name); } /** @@ -2218,16 +2579,22 @@ public static function setDefaultDriver($name) * * @param string $driver * @param \Closure $callback - * @return $this + * @return \Illuminate\Broadcasting\BroadcastManager * @static */ public static function extend($driver, $callback) { - return \Illuminate\Broadcasting\BroadcastManager::extend($driver, $callback); + /** @var \Illuminate\Broadcasting\BroadcastManager $instance */ + return $instance->extend($driver, $callback); } } + /** + * + * + * @see \Illuminate\Contracts\Bus\Dispatcher + */ class Bus { /** @@ -2239,7 +2606,8 @@ class Bus { */ public static function dispatch($command) { - return \Illuminate\Bus\Dispatcher::dispatch($command); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->dispatch($command); } /** @@ -2252,7 +2620,8 @@ public static function dispatch($command) */ public static function dispatchNow($command, $handler = null) { - return \Illuminate\Bus\Dispatcher::dispatchNow($command, $handler); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->dispatchNow($command, $handler); } /** @@ -2264,7 +2633,8 @@ public static function dispatchNow($command, $handler = null) */ public static function hasCommandHandler($command) { - return \Illuminate\Bus\Dispatcher::hasCommandHandler($command); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->hasCommandHandler($command); } /** @@ -2276,7 +2646,8 @@ public static function hasCommandHandler($command) */ public static function getCommandHandler($command) { - return \Illuminate\Bus\Dispatcher::getCommandHandler($command); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->getCommandHandler($command); } /** @@ -2289,82 +2660,150 @@ public static function getCommandHandler($command) */ public static function dispatchToQueue($command) { - return \Illuminate\Bus\Dispatcher::dispatchToQueue($command); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->dispatchToQueue($command); } /** * Set the pipes through which commands should be piped before dispatching. * * @param array $pipes - * @return $this + * @return \Illuminate\Bus\Dispatcher * @static */ public static function pipeThrough($pipes) { - return \Illuminate\Bus\Dispatcher::pipeThrough($pipes); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->pipeThrough($pipes); } /** * Map a command to a handler. * * @param array $map - * @return $this + * @return \Illuminate\Bus\Dispatcher * @static */ public static function map($map) { - return \Illuminate\Bus\Dispatcher::map($map); + /** @var \Illuminate\Bus\Dispatcher $instance */ + return $instance->map($map); } - - } - - class Cache { /** - * Get a cache store instance by name. + * Assert if a job was dispatched based on a truth-test callback. * - * @param string|null $name - * @return mixed + * @param string $command + * @param callable|int|null $callback + * @return void * @static */ - public static function store($name = null) + public static function assertDispatched($command, $callback = null) { - return \Illuminate\Cache\CacheManager::store($name); + /** @var \Illuminate\Support\Testing\Fakes\BusFake $instance */ + $instance->assertDispatched($command, $callback); } /** - * Get a cache driver instance. + * Determine if a job was dispatched based on a truth-test callback. * - * @param string $driver - * @return mixed + * @param string $command + * @param callable|null $callback + * @return void * @static */ - public static function driver($driver = null) + public static function assertNotDispatched($command, $callback = null) { - return \Illuminate\Cache\CacheManager::driver($driver); + /** @var \Illuminate\Support\Testing\Fakes\BusFake $instance */ + $instance->assertNotDispatched($command, $callback); } /** - * Create a new cache repository with the given implementation. + * Get all of the jobs matching a truth-test callback. * - * @param \Illuminate\Contracts\Cache\Store $store - * @return \Illuminate\Cache\Repository + * @param string $command + * @param callable|null $callback + * @return \Illuminate\Support\Collection * @static */ - public static function repository($store) + public static function dispatched($command, $callback = null) { - return \Illuminate\Cache\CacheManager::repository($store); + /** @var \Illuminate\Support\Testing\Fakes\BusFake $instance */ + return $instance->dispatched($command, $callback); } /** - * Get the default cache driver name. + * Determine if there are any stored commands for a given class. * - * @return string - * @static + * @param string $command + * @return bool + * @static + */ + public static function hasDispatched($command) + { + /** @var \Illuminate\Support\Testing\Fakes\BusFake $instance */ + return $instance->hasDispatched($command); + } + + } + + /** + * + * + * @see \Illuminate\Cache\CacheManager + * @see \Illuminate\Cache\Repository + */ + class Cache { + + /** + * Get a cache store instance by name. + * + * @param string|null $name + * @return \Illuminate\Contracts\Cache\Repository + * @static + */ + public static function store($name = null) + { + /** @var \Illuminate\Cache\CacheManager $instance */ + return $instance->store($name); + } + + /** + * Get a cache driver instance. + * + * @param string|null $driver + * @return mixed + * @static + */ + public static function driver($driver = null) + { + /** @var \Illuminate\Cache\CacheManager $instance */ + return $instance->driver($driver); + } + + /** + * Create a new cache repository with the given implementation. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @return \Illuminate\Cache\Repository + * @static + */ + public static function repository($store) + { + /** @var \Illuminate\Cache\CacheManager $instance */ + return $instance->repository($store); + } + + /** + * Get the default cache driver name. + * + * @return string + * @static */ public static function getDefaultDriver() { - return \Illuminate\Cache\CacheManager::getDefaultDriver(); + /** @var \Illuminate\Cache\CacheManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -2376,7 +2815,8 @@ public static function getDefaultDriver() */ public static function setDefaultDriver($name) { - \Illuminate\Cache\CacheManager::setDefaultDriver($name); + /** @var \Illuminate\Cache\CacheManager $instance */ + $instance->setDefaultDriver($name); } /** @@ -2384,12 +2824,13 @@ public static function setDefaultDriver($name) * * @param string $driver * @param \Closure $callback - * @return $this + * @return \Illuminate\Cache\CacheManager * @static */ public static function extend($driver, $callback) { - return \Illuminate\Cache\CacheManager::extend($driver, $callback); + /** @var \Illuminate\Cache\CacheManager $instance */ + return $instance->extend($driver, $callback); } /** @@ -2401,7 +2842,8 @@ public static function extend($driver, $callback) */ public static function has($key) { - return \Illuminate\Cache\Repository::has($key); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->has($key); } /** @@ -2414,7 +2856,8 @@ public static function has($key) */ public static function get($key, $default = null) { - return \Illuminate\Cache\Repository::get($key, $default); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->get($key, $default); } /** @@ -2428,7 +2871,25 @@ public static function get($key, $default = null) */ public static function many($keys) { - return \Illuminate\Cache\Repository::many($keys); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->many($keys); + } + + /** + * Obtains multiple cache items by their unique keys. + * + * @param \Psr\SimpleCache\iterable $keys A list of keys that can obtained in a single operation. + * @param mixed $default Default value to return for keys that do not exist. + * @return \Psr\SimpleCache\iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value. + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $keys is neither an array nor a Traversable, + * or if any of the $keys are not a legal value. + * @static + */ + public static function getMultiple($keys, $default = null) + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->getMultiple($keys, $default); } /** @@ -2441,7 +2902,8 @@ public static function many($keys) */ public static function pull($key, $default = null) { - return \Illuminate\Cache\Repository::pull($key, $default); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->pull($key, $default); } /** @@ -2449,26 +2911,66 @@ public static function pull($key, $default = null) * * @param string $key * @param mixed $value - * @param \DateTime|float|int $minutes + * @param \DateTimeInterface|\DateInterval|float|int|null $minutes * @return void * @static */ public static function put($key, $value, $minutes = null) { - \Illuminate\Cache\Repository::put($key, $value, $minutes); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->put($key, $value, $minutes); + } + + /** + * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. + * + * @param string $key The key of the item to store. + * @param mixed $value The value of the item to store, must be serializable. + * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * @return bool True on success and false on failure. + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + * @static + */ + public static function set($key, $value, $ttl = null) + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->set($key, $value, $ttl); } /** * Store multiple items in the cache for a given number of minutes. * * @param array $values - * @param float|int $minutes + * @param \DateTimeInterface|\DateInterval|float|int $minutes * @return void * @static */ public static function putMany($values, $minutes) { - \Illuminate\Cache\Repository::putMany($values, $minutes); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->putMany($values, $minutes); + } + + /** + * Persists a set of key => value pairs in the cache, with an optional TTL. + * + * @param \Psr\SimpleCache\iterable $values A list of key => value pairs for a multiple-set operation. + * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * @return bool True on success and false on failure. + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $values is neither an array nor a Traversable, + * or if any of the $values are not a legal value. + * @static + */ + public static function setMultiple($values, $ttl = null) + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->setMultiple($values, $ttl); } /** @@ -2476,13 +2978,14 @@ public static function putMany($values, $minutes) * * @param string $key * @param mixed $value - * @param \DateTime|float|int $minutes + * @param \DateTimeInterface|\DateInterval|float|int $minutes * @return bool * @static */ public static function add($key, $value, $minutes) { - return \Illuminate\Cache\Repository::add($key, $value, $minutes); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->add($key, $value, $minutes); } /** @@ -2495,7 +2998,8 @@ public static function add($key, $value, $minutes) */ public static function increment($key, $value = 1) { - return \Illuminate\Cache\Repository::increment($key, $value); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->increment($key, $value); } /** @@ -2508,7 +3012,8 @@ public static function increment($key, $value = 1) */ public static function decrement($key, $value = 1) { - return \Illuminate\Cache\Repository::decrement($key, $value); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->decrement($key, $value); } /** @@ -2521,21 +3026,23 @@ public static function decrement($key, $value = 1) */ public static function forever($key, $value) { - \Illuminate\Cache\Repository::forever($key, $value); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->forever($key, $value); } /** * Get an item from the cache, or store the default value. * * @param string $key - * @param \DateTime|float|int $minutes + * @param \DateTimeInterface|\DateInterval|float|int $minutes * @param \Closure $callback * @return mixed * @static */ public static function remember($key, $minutes, $callback) { - return \Illuminate\Cache\Repository::remember($key, $minutes, $callback); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->remember($key, $minutes, $callback); } /** @@ -2548,7 +3055,8 @@ public static function remember($key, $minutes, $callback) */ public static function sear($key, $callback) { - return \Illuminate\Cache\Repository::sear($key, $callback); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->sear($key, $callback); } /** @@ -2561,7 +3069,8 @@ public static function sear($key, $callback) */ public static function rememberForever($key, $callback) { - return \Illuminate\Cache\Repository::rememberForever($key, $callback); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->rememberForever($key, $callback); } /** @@ -2573,7 +3082,51 @@ public static function rememberForever($key, $callback) */ public static function forget($key) { - return \Illuminate\Cache\Repository::forget($key); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->forget($key); + } + + /** + * Delete an item from the cache by its unique key. + * + * @param string $key The unique cache key of the item to delete. + * @return bool True if the item was successfully removed. False if there was an error. + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + * @static + */ + public static function delete($key) + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->delete($key); + } + + /** + * Deletes multiple cache items in a single operation. + * + * @param \Psr\SimpleCache\iterable $keys A list of string-based keys to be deleted. + * @return bool True if the items were successfully removed. False if there was an error. + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $keys is neither an array nor a Traversable, + * or if any of the $keys are not a legal value. + * @static + */ + public static function deleteMultiple($keys) + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->deleteMultiple($keys); + } + + /** + * Wipes clean the entire cache's keys. + * + * @return bool True on success and false on failure. + * @static + */ + public static function clear() + { + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->clear(); } /** @@ -2586,7 +3139,8 @@ public static function forget($key) */ public static function tags($names) { - return \Illuminate\Cache\Repository::tags($names); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->tags($names); } /** @@ -2597,19 +3151,21 @@ public static function tags($names) */ public static function getDefaultCacheTime() { - return \Illuminate\Cache\Repository::getDefaultCacheTime(); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->getDefaultCacheTime(); } /** * Set the default cache time in minutes. * * @param float|int $minutes - * @return $this + * @return \Illuminate\Cache\Repository * @static */ public static function setDefaultCacheTime($minutes) { - return \Illuminate\Cache\Repository::setDefaultCacheTime($minutes); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->setDefaultCacheTime($minutes); } /** @@ -2620,7 +3176,8 @@ public static function setDefaultCacheTime($minutes) */ public static function getStore() { - return \Illuminate\Cache\Repository::getStore(); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->getStore(); } /** @@ -2632,7 +3189,8 @@ public static function getStore() */ public static function setEventDispatcher($events) { - \Illuminate\Cache\Repository::setEventDispatcher($events); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->setEventDispatcher($events); } /** @@ -2644,7 +3202,8 @@ public static function setEventDispatcher($events) */ public static function offsetExists($key) { - return \Illuminate\Cache\Repository::offsetExists($key); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->offsetExists($key); } /** @@ -2656,7 +3215,8 @@ public static function offsetExists($key) */ public static function offsetGet($key) { - return \Illuminate\Cache\Repository::offsetGet($key); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->offsetGet($key); } /** @@ -2669,7 +3229,8 @@ public static function offsetGet($key) */ public static function offsetSet($key, $value) { - \Illuminate\Cache\Repository::offsetSet($key, $value); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->offsetSet($key, $value); } /** @@ -2681,20 +3242,34 @@ public static function offsetSet($key, $value) */ public static function offsetUnset($key) { - \Illuminate\Cache\Repository::offsetUnset($key); + /** @var \Illuminate\Cache\Repository $instance */ + $instance->offsetUnset($key); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Cache\Repository::macro($name, $macro); + \Illuminate\Cache\Repository::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Cache\Repository::mixin($mixin); } /** @@ -2706,7 +3281,7 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Cache\Repository::hasMacro($name); + return \Illuminate\Cache\Repository::hasMacro($name); } /** @@ -2720,7 +3295,22 @@ public static function hasMacro($name) */ public static function macroCall($method, $parameters) { - return \Illuminate\Cache\Repository::macroCall($method, $parameters); + /** @var \Illuminate\Cache\Repository $instance */ + return $instance->macroCall($method, $parameters); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @return \Illuminate\Contracts\Cache\Lock + * @static + */ + public static function lock($name, $seconds = 0) + { + /** @var \Illuminate\Cache\RedisStore $instance */ + return $instance->lock($name, $seconds); } /** @@ -2731,29 +3321,45 @@ public static function macroCall($method, $parameters) */ public static function flush() { - return \Illuminate\Cache\FileStore::flush(); + /** @var \Illuminate\Cache\RedisStore $instance */ + return $instance->flush(); } /** - * Get the Filesystem instance. + * Get the Redis connection instance. * - * @return \Illuminate\Filesystem\Filesystem + * @return \Predis\ClientInterface * @static */ - public static function getFilesystem() + public static function connection() { - return \Illuminate\Cache\FileStore::getFilesystem(); + /** @var \Illuminate\Cache\RedisStore $instance */ + return $instance->connection(); } /** - * Get the working directory of the cache. + * Set the connection name to be used. * - * @return string + * @param string $connection + * @return void + * @static + */ + public static function setConnection($connection) + { + /** @var \Illuminate\Cache\RedisStore $instance */ + $instance->setConnection($connection); + } + + /** + * Get the Redis database instance. + * + * @return \Illuminate\Contracts\Redis\Factory * @static */ - public static function getDirectory() + public static function getRedis() { - return \Illuminate\Cache\FileStore::getDirectory(); + /** @var \Illuminate\Cache\RedisStore $instance */ + return $instance->getRedis(); } /** @@ -2764,11 +3370,30 @@ public static function getDirectory() */ public static function getPrefix() { - return \Illuminate\Cache\FileStore::getPrefix(); + /** @var \Illuminate\Cache\RedisStore $instance */ + return $instance->getPrefix(); + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + * @static + */ + public static function setPrefix($prefix) + { + /** @var \Illuminate\Cache\RedisStore $instance */ + $instance->setPrefix($prefix); } } + /** + * + * + * @see \Illuminate\Config\Repository + */ class Config { /** @@ -2780,20 +3405,35 @@ class Config { */ public static function has($key) { - return \Illuminate\Config\Repository::has($key); + /** @var \Illuminate\Config\Repository $instance */ + return $instance->has($key); } /** * Get the specified configuration value. * - * @param string $key + * @param array|string $key * @param mixed $default * @return mixed * @static */ public static function get($key, $default = null) { - return \Illuminate\Config\Repository::get($key, $default); + /** @var \Illuminate\Config\Repository $instance */ + return $instance->get($key, $default); + } + + /** + * Get many configuration values. + * + * @param array $keys + * @return array + * @static + */ + public static function getMany($keys) + { + /** @var \Illuminate\Config\Repository $instance */ + return $instance->getMany($keys); } /** @@ -2806,7 +3446,8 @@ public static function get($key, $default = null) */ public static function set($key, $value = null) { - \Illuminate\Config\Repository::set($key, $value); + /** @var \Illuminate\Config\Repository $instance */ + $instance->set($key, $value); } /** @@ -2819,7 +3460,8 @@ public static function set($key, $value = null) */ public static function prepend($key, $value) { - \Illuminate\Config\Repository::prepend($key, $value); + /** @var \Illuminate\Config\Repository $instance */ + $instance->prepend($key, $value); } /** @@ -2832,7 +3474,8 @@ public static function prepend($key, $value) */ public static function push($key, $value) { - \Illuminate\Config\Repository::push($key, $value); + /** @var \Illuminate\Config\Repository $instance */ + $instance->push($key, $value); } /** @@ -2843,7 +3486,8 @@ public static function push($key, $value) */ public static function all() { - return \Illuminate\Config\Repository::all(); + /** @var \Illuminate\Config\Repository $instance */ + return $instance->all(); } /** @@ -2855,7 +3499,8 @@ public static function all() */ public static function offsetExists($key) { - return \Illuminate\Config\Repository::offsetExists($key); + /** @var \Illuminate\Config\Repository $instance */ + return $instance->offsetExists($key); } /** @@ -2867,7 +3512,8 @@ public static function offsetExists($key) */ public static function offsetGet($key) { - return \Illuminate\Config\Repository::offsetGet($key); + /** @var \Illuminate\Config\Repository $instance */ + return $instance->offsetGet($key); } /** @@ -2880,7 +3526,8 @@ public static function offsetGet($key) */ public static function offsetSet($key, $value) { - \Illuminate\Config\Repository::offsetSet($key, $value); + /** @var \Illuminate\Config\Repository $instance */ + $instance->offsetSet($key, $value); } /** @@ -2892,11 +3539,17 @@ public static function offsetSet($key, $value) */ public static function offsetUnset($key) { - \Illuminate\Config\Repository::offsetUnset($key); + /** @var \Illuminate\Config\Repository $instance */ + $instance->offsetUnset($key); } } + /** + * + * + * @see \Illuminate\Cookie\CookieJar + */ class Cookie { /** @@ -2907,14 +3560,17 @@ class Cookie { * @param int $minutes * @param string $path * @param string $domain - * @param bool $secure + * @param bool|null $secure * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite * @return \Symfony\Component\HttpFoundation\Cookie * @static */ - public static function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) + public static function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) { - return \Illuminate\Cookie\CookieJar::make($name, $value, $minutes, $path, $domain, $secure, $httpOnly); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly, $raw, $sameSite); } /** @@ -2924,14 +3580,17 @@ public static function make($name, $value, $minutes = 0, $path = null, $domain = * @param string $value * @param string $path * @param string $domain - * @param bool $secure + * @param bool|null $secure * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite * @return \Symfony\Component\HttpFoundation\Cookie * @static */ - public static function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true) + public static function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) { - return \Illuminate\Cookie\CookieJar::forever($name, $value, $path, $domain, $secure, $httpOnly); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->forever($name, $value, $path, $domain, $secure, $httpOnly, $raw, $sameSite); } /** @@ -2945,7 +3604,8 @@ public static function forever($name, $value, $path = null, $domain = null, $sec */ public static function forget($name, $path = null, $domain = null) { - return \Illuminate\Cookie\CookieJar::forget($name, $path, $domain); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->forget($name, $path, $domain); } /** @@ -2957,7 +3617,8 @@ public static function forget($name, $path = null, $domain = null) */ public static function hasQueued($key) { - return \Illuminate\Cookie\CookieJar::hasQueued($key); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->hasQueued($key); } /** @@ -2970,7 +3631,8 @@ public static function hasQueued($key) */ public static function queued($key, $default = null) { - return \Illuminate\Cookie\CookieJar::queued($key, $default); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->queued($key, $default); } /** @@ -2982,7 +3644,8 @@ public static function queued($key, $default = null) */ public static function queue($parameters = null) { - \Illuminate\Cookie\CookieJar::queue($parameters); + /** @var \Illuminate\Cookie\CookieJar $instance */ + $instance->queue($parameters); } /** @@ -2994,7 +3657,8 @@ public static function queue($parameters = null) */ public static function unqueue($name) { - \Illuminate\Cookie\CookieJar::unqueue($name); + /** @var \Illuminate\Cookie\CookieJar $instance */ + $instance->unqueue($name); } /** @@ -3003,27 +3667,35 @@ public static function unqueue($name) * @param string $path * @param string $domain * @param bool $secure - * @return $this + * @param string $sameSite + * @return \Illuminate\Cookie\CookieJar * @static */ - public static function setDefaultPathAndDomain($path, $domain, $secure = false) + public static function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null) { - return \Illuminate\Cookie\CookieJar::setDefaultPathAndDomain($path, $domain, $secure); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->setDefaultPathAndDomain($path, $domain, $secure, $sameSite); } /** * Get the cookies which have been queued for the next request. * - * @return array + * @return \Symfony\Component\HttpFoundation\Cookie[] * @static */ public static function getQueuedCookies() { - return \Illuminate\Cookie\CookieJar::getQueuedCookies(); + /** @var \Illuminate\Cookie\CookieJar $instance */ + return $instance->getQueuedCookies(); } } + /** + * + * + * @see \Illuminate\Encryption\Encrypter + */ class Crypt { /** @@ -3036,7 +3708,19 @@ class Crypt { */ public static function supported($key, $cipher) { - return \Illuminate\Encryption\Encrypter::supported($key, $cipher); + return \Illuminate\Encryption\Encrypter::supported($key, $cipher); + } + + /** + * Create a new encryption key for the given cipher. + * + * @param string $cipher + * @return string + * @static + */ + public static function generateKey($cipher) + { + return \Illuminate\Encryption\Encrypter::generateKey($cipher); } /** @@ -3050,7 +3734,8 @@ public static function supported($key, $cipher) */ public static function encrypt($value, $serialize = true) { - return \Illuminate\Encryption\Encrypter::encrypt($value, $serialize); + /** @var \Illuminate\Encryption\Encrypter $instance */ + return $instance->encrypt($value, $serialize); } /** @@ -3062,7 +3747,8 @@ public static function encrypt($value, $serialize = true) */ public static function encryptString($value) { - return \Illuminate\Encryption\Encrypter::encryptString($value); + /** @var \Illuminate\Encryption\Encrypter $instance */ + return $instance->encryptString($value); } /** @@ -3070,13 +3756,14 @@ public static function encryptString($value) * * @param mixed $payload * @param bool $unserialize - * @return string + * @return mixed * @throws \Illuminate\Contracts\Encryption\DecryptException * @static */ public static function decrypt($payload, $unserialize = true) { - return \Illuminate\Encryption\Encrypter::decrypt($payload, $unserialize); + /** @var \Illuminate\Encryption\Encrypter $instance */ + return $instance->decrypt($payload, $unserialize); } /** @@ -3088,7 +3775,8 @@ public static function decrypt($payload, $unserialize = true) */ public static function decryptString($payload) { - return \Illuminate\Encryption\Encrypter::decryptString($payload); + /** @var \Illuminate\Encryption\Encrypter $instance */ + return $instance->decryptString($payload); } /** @@ -3099,11 +3787,18 @@ public static function decryptString($payload) */ public static function getKey() { - return \Illuminate\Encryption\Encrypter::getKey(); + /** @var \Illuminate\Encryption\Encrypter $instance */ + return $instance->getKey(); } } + /** + * + * + * @see \Illuminate\Database\DatabaseManager + * @see \Illuminate\Database\Connection + */ class DB { /** @@ -3115,7 +3810,8 @@ class DB { */ public static function connection($name = null) { - return \Illuminate\Database\DatabaseManager::connection($name); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->connection($name); } /** @@ -3127,7 +3823,8 @@ public static function connection($name = null) */ public static function purge($name = null) { - \Illuminate\Database\DatabaseManager::purge($name); + /** @var \Illuminate\Database\DatabaseManager $instance */ + $instance->purge($name); } /** @@ -3139,7 +3836,8 @@ public static function purge($name = null) */ public static function disconnect($name = null) { - \Illuminate\Database\DatabaseManager::disconnect($name); + /** @var \Illuminate\Database\DatabaseManager $instance */ + $instance->disconnect($name); } /** @@ -3151,7 +3849,8 @@ public static function disconnect($name = null) */ public static function reconnect($name = null) { - return \Illuminate\Database\DatabaseManager::reconnect($name); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->reconnect($name); } /** @@ -3162,7 +3861,8 @@ public static function reconnect($name = null) */ public static function getDefaultConnection() { - return \Illuminate\Database\DatabaseManager::getDefaultConnection(); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->getDefaultConnection(); } /** @@ -3174,7 +3874,8 @@ public static function getDefaultConnection() */ public static function setDefaultConnection($name) { - \Illuminate\Database\DatabaseManager::setDefaultConnection($name); + /** @var \Illuminate\Database\DatabaseManager $instance */ + $instance->setDefaultConnection($name); } /** @@ -3185,7 +3886,8 @@ public static function setDefaultConnection($name) */ public static function supportedDrivers() { - return \Illuminate\Database\DatabaseManager::supportedDrivers(); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->supportedDrivers(); } /** @@ -3196,7 +3898,8 @@ public static function supportedDrivers() */ public static function availableDrivers() { - return \Illuminate\Database\DatabaseManager::availableDrivers(); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->availableDrivers(); } /** @@ -3209,7 +3912,8 @@ public static function availableDrivers() */ public static function extend($name, $resolver) { - \Illuminate\Database\DatabaseManager::extend($name, $resolver); + /** @var \Illuminate\Database\DatabaseManager $instance */ + $instance->extend($name, $resolver); } /** @@ -3220,7 +3924,8 @@ public static function extend($name, $resolver) */ public static function getConnections() { - return \Illuminate\Database\DatabaseManager::getConnections(); + /** @var \Illuminate\Database\DatabaseManager $instance */ + return $instance->getConnections(); } /** @@ -3231,7 +3936,8 @@ public static function getConnections() */ public static function getSchemaBuilder() { - return \Illuminate\Database\MySqlConnection::getSchemaBuilder(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getSchemaBuilder(); } /** @@ -3244,7 +3950,8 @@ public static function getSchemaBuilder() */ public static function bindValues($statement, $bindings) { - \Illuminate\Database\MySqlConnection::bindValues($statement, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->bindValues($statement, $bindings); } /** @@ -3256,7 +3963,8 @@ public static function bindValues($statement, $bindings) public static function useDefaultQueryGrammar() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::useDefaultQueryGrammar(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->useDefaultQueryGrammar(); } /** @@ -3268,7 +3976,8 @@ public static function useDefaultQueryGrammar() public static function useDefaultSchemaGrammar() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::useDefaultSchemaGrammar(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->useDefaultSchemaGrammar(); } /** @@ -3280,7 +3989,8 @@ public static function useDefaultSchemaGrammar() public static function useDefaultPostProcessor() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::useDefaultPostProcessor(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->useDefaultPostProcessor(); } /** @@ -3293,7 +4003,8 @@ public static function useDefaultPostProcessor() public static function table($table) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::table($table); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->table($table); } /** @@ -3305,7 +4016,8 @@ public static function table($table) public static function query() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::query(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->query(); } /** @@ -3320,7 +4032,8 @@ public static function query() public static function selectOne($query, $bindings = array(), $useReadPdo = true) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::selectOne($query, $bindings, $useReadPdo); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->selectOne($query, $bindings, $useReadPdo); } /** @@ -3334,7 +4047,8 @@ public static function selectOne($query, $bindings = array(), $useReadPdo = true public static function selectFromWriteConnection($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::selectFromWriteConnection($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->selectFromWriteConnection($query, $bindings); } /** @@ -3349,7 +4063,8 @@ public static function selectFromWriteConnection($query, $bindings = array()) public static function select($query, $bindings = array(), $useReadPdo = true) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::select($query, $bindings, $useReadPdo); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->select($query, $bindings, $useReadPdo); } /** @@ -3364,7 +4079,8 @@ public static function select($query, $bindings = array(), $useReadPdo = true) public static function cursor($query, $bindings = array(), $useReadPdo = true) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::cursor($query, $bindings, $useReadPdo); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->cursor($query, $bindings, $useReadPdo); } /** @@ -3378,7 +4094,8 @@ public static function cursor($query, $bindings = array(), $useReadPdo = true) public static function insert($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::insert($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->insert($query, $bindings); } /** @@ -3392,7 +4109,8 @@ public static function insert($query, $bindings = array()) public static function update($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::update($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->update($query, $bindings); } /** @@ -3406,7 +4124,8 @@ public static function update($query, $bindings = array()) public static function delete($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::delete($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->delete($query, $bindings); } /** @@ -3420,7 +4139,8 @@ public static function delete($query, $bindings = array()) public static function statement($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::statement($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->statement($query, $bindings); } /** @@ -3434,7 +4154,8 @@ public static function statement($query, $bindings = array()) public static function affectingStatement($query, $bindings = array()) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::affectingStatement($query, $bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->affectingStatement($query, $bindings); } /** @@ -3447,7 +4168,8 @@ public static function affectingStatement($query, $bindings = array()) public static function unprepared($query) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::unprepared($query); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->unprepared($query); } /** @@ -3460,7 +4182,8 @@ public static function unprepared($query) public static function pretend($callback) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::pretend($callback); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->pretend($callback); } /** @@ -3473,7 +4196,8 @@ public static function pretend($callback) public static function prepareBindings($bindings) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::prepareBindings($bindings); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->prepareBindings($bindings); } /** @@ -3488,7 +4212,8 @@ public static function prepareBindings($bindings) public static function logQuery($query, $bindings, $time = null) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::logQuery($query, $bindings, $time); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->logQuery($query, $bindings, $time); } /** @@ -3501,7 +4226,8 @@ public static function logQuery($query, $bindings, $time = null) public static function listen($callback) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::listen($callback); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->listen($callback); } /** @@ -3514,7 +4240,22 @@ public static function listen($callback) public static function raw($value) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::raw($value); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->raw($value); + } + + /** + * Indicate if any records have been modified. + * + * @param bool $value + * @return void + * @static + */ + public static function recordsHaveBeenModified($value = true) + { + //Method inherited from \Illuminate\Database\Connection + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->recordsHaveBeenModified($value); } /** @@ -3526,7 +4267,8 @@ public static function raw($value) public static function isDoctrineAvailable() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::isDoctrineAvailable(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->isDoctrineAvailable(); } /** @@ -3540,7 +4282,8 @@ public static function isDoctrineAvailable() public static function getDoctrineColumn($table, $column) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getDoctrineColumn($table, $column); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getDoctrineColumn($table, $column); } /** @@ -3552,7 +4295,8 @@ public static function getDoctrineColumn($table, $column) public static function getDoctrineSchemaManager() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getDoctrineSchemaManager(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getDoctrineSchemaManager(); } /** @@ -3564,7 +4308,8 @@ public static function getDoctrineSchemaManager() public static function getDoctrineConnection() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getDoctrineConnection(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getDoctrineConnection(); } /** @@ -3576,7 +4321,8 @@ public static function getDoctrineConnection() public static function getPdo() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getPdo(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getPdo(); } /** @@ -3588,46 +4334,50 @@ public static function getPdo() public static function getReadPdo() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getReadPdo(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getReadPdo(); } /** * Set the PDO connection. * - * @param \PDO|null $pdo - * @return $this + * @param \PDO|\Closure|null $pdo + * @return \Illuminate\Database\MySqlConnection * @static */ public static function setPdo($pdo) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::setPdo($pdo); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->setPdo($pdo); } /** * Set the PDO connection used for reading. * - * @param \PDO|null $pdo - * @return $this + * @param \PDO|\Closure|null $pdo + * @return \Illuminate\Database\MySqlConnection * @static */ public static function setReadPdo($pdo) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::setReadPdo($pdo); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->setReadPdo($pdo); } /** * Set the reconnect instance on the connection. * * @param callable $reconnector - * @return $this + * @return \Illuminate\Database\MySqlConnection * @static */ public static function setReconnector($reconnector) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::setReconnector($reconnector); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->setReconnector($reconnector); } /** @@ -3639,7 +4389,8 @@ public static function setReconnector($reconnector) public static function getName() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getName(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getName(); } /** @@ -3652,7 +4403,8 @@ public static function getName() public static function getConfig($option = null) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getConfig($option); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getConfig($option); } /** @@ -3664,7 +4416,8 @@ public static function getConfig($option = null) public static function getDriverName() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getDriverName(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getDriverName(); } /** @@ -3676,7 +4429,8 @@ public static function getDriverName() public static function getQueryGrammar() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getQueryGrammar(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getQueryGrammar(); } /** @@ -3689,7 +4443,8 @@ public static function getQueryGrammar() public static function setQueryGrammar($grammar) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::setQueryGrammar($grammar); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->setQueryGrammar($grammar); } /** @@ -3701,7 +4456,8 @@ public static function setQueryGrammar($grammar) public static function getSchemaGrammar() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getSchemaGrammar(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getSchemaGrammar(); } /** @@ -3714,7 +4470,8 @@ public static function getSchemaGrammar() public static function setSchemaGrammar($grammar) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::setSchemaGrammar($grammar); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->setSchemaGrammar($grammar); } /** @@ -3726,7 +4483,8 @@ public static function setSchemaGrammar($grammar) public static function getPostProcessor() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getPostProcessor(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getPostProcessor(); } /** @@ -3739,7 +4497,8 @@ public static function getPostProcessor() public static function setPostProcessor($processor) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::setPostProcessor($processor); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->setPostProcessor($processor); } /** @@ -3751,7 +4510,8 @@ public static function setPostProcessor($processor) public static function getEventDispatcher() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getEventDispatcher(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getEventDispatcher(); } /** @@ -3764,7 +4524,21 @@ public static function getEventDispatcher() public static function setEventDispatcher($events) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::setEventDispatcher($events); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->setEventDispatcher($events); + } + + /** + * Unset the event dispatcher for this connection. + * + * @return void + * @static + */ + public static function unsetEventDispatcher() + { + //Method inherited from \Illuminate\Database\Connection + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->unsetEventDispatcher(); } /** @@ -3776,7 +4550,8 @@ public static function setEventDispatcher($events) public static function pretending() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::pretending(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->pretending(); } /** @@ -3788,7 +4563,8 @@ public static function pretending() public static function getQueryLog() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getQueryLog(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getQueryLog(); } /** @@ -3800,7 +4576,8 @@ public static function getQueryLog() public static function flushQueryLog() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::flushQueryLog(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->flushQueryLog(); } /** @@ -3812,7 +4589,8 @@ public static function flushQueryLog() public static function enableQueryLog() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::enableQueryLog(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->enableQueryLog(); } /** @@ -3824,7 +4602,8 @@ public static function enableQueryLog() public static function disableQueryLog() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::disableQueryLog(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->disableQueryLog(); } /** @@ -3836,7 +4615,8 @@ public static function disableQueryLog() public static function logging() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::logging(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->logging(); } /** @@ -3848,7 +4628,8 @@ public static function logging() public static function getDatabaseName() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getDatabaseName(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getDatabaseName(); } /** @@ -3861,7 +4642,8 @@ public static function getDatabaseName() public static function setDatabaseName($database) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::setDatabaseName($database); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->setDatabaseName($database); } /** @@ -3873,7 +4655,8 @@ public static function setDatabaseName($database) public static function getTablePrefix() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getTablePrefix(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->getTablePrefix(); } /** @@ -3886,7 +4669,8 @@ public static function getTablePrefix() public static function setTablePrefix($prefix) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::setTablePrefix($prefix); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->setTablePrefix($prefix); } /** @@ -3899,7 +4683,8 @@ public static function setTablePrefix($prefix) public static function withTablePrefix($grammar) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::withTablePrefix($grammar); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->withTablePrefix($grammar); } /** @@ -3913,7 +4698,7 @@ public static function withTablePrefix($grammar) public static function resolverFor($driver, $callback) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::resolverFor($driver, $callback); + \Illuminate\Database\MySqlConnection::resolverFor($driver, $callback); } /** @@ -3926,7 +4711,7 @@ public static function resolverFor($driver, $callback) public static function getResolver($driver) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::getResolver($driver); + return \Illuminate\Database\MySqlConnection::getResolver($driver); } /** @@ -3941,7 +4726,8 @@ public static function getResolver($driver) public static function transaction($callback, $attempts = 1) { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::transaction($callback, $attempts); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->transaction($callback, $attempts); } /** @@ -3954,7 +4740,8 @@ public static function transaction($callback, $attempts = 1) public static function beginTransaction() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::beginTransaction(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->beginTransaction(); } /** @@ -3966,7 +4753,8 @@ public static function beginTransaction() public static function commit() { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::commit(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->commit(); } /** @@ -3974,12 +4762,14 @@ public static function commit() * * @param int|null $toLevel * @return void + * @throws \Exception * @static */ public static function rollBack($toLevel = null) { //Method inherited from \Illuminate\Database\Connection - \Illuminate\Database\MySqlConnection::rollBack($toLevel); + /** @var \Illuminate\Database\MySqlConnection $instance */ + $instance->rollBack($toLevel); } /** @@ -3991,11 +4781,17 @@ public static function rollBack($toLevel = null) public static function transactionLevel() { //Method inherited from \Illuminate\Database\Connection - return \Illuminate\Database\MySqlConnection::transactionLevel(); + /** @var \Illuminate\Database\MySqlConnection $instance */ + return $instance->transactionLevel(); } } + /** + * + * + * @see \Illuminate\Events\Dispatcher + */ class Event { /** @@ -4008,7 +4804,8 @@ class Event { */ public static function listen($events, $listener) { - \Illuminate\Events\Dispatcher::listen($events, $listener); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->listen($events, $listener); } /** @@ -4020,7 +4817,8 @@ public static function listen($events, $listener) */ public static function hasListeners($eventName) { - return \Illuminate\Events\Dispatcher::hasListeners($eventName); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->hasListeners($eventName); } /** @@ -4033,7 +4831,8 @@ public static function hasListeners($eventName) */ public static function push($event, $payload = array()) { - \Illuminate\Events\Dispatcher::push($event, $payload); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->push($event, $payload); } /** @@ -4045,7 +4844,8 @@ public static function push($event, $payload = array()) */ public static function flush($event) { - \Illuminate\Events\Dispatcher::flush($event); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->flush($event); } /** @@ -4057,7 +4857,8 @@ public static function flush($event) */ public static function subscribe($subscriber) { - \Illuminate\Events\Dispatcher::subscribe($subscriber); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->subscribe($subscriber); } /** @@ -4070,7 +4871,8 @@ public static function subscribe($subscriber) */ public static function until($event, $payload = array()) { - return \Illuminate\Events\Dispatcher::until($event, $payload); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->until($event, $payload); } /** @@ -4084,7 +4886,8 @@ public static function until($event, $payload = array()) */ public static function fire($event, $payload = array(), $halt = false) { - return \Illuminate\Events\Dispatcher::fire($event, $payload, $halt); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->fire($event, $payload, $halt); } /** @@ -4098,7 +4901,8 @@ public static function fire($event, $payload = array(), $halt = false) */ public static function dispatch($event, $payload = array(), $halt = false) { - return \Illuminate\Events\Dispatcher::dispatch($event, $payload, $halt); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->dispatch($event, $payload, $halt); } /** @@ -4110,20 +4914,22 @@ public static function dispatch($event, $payload = array(), $halt = false) */ public static function getListeners($eventName) { - return \Illuminate\Events\Dispatcher::getListeners($eventName); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->getListeners($eventName); } /** * Register an event listener with the dispatcher. * - * @param string|\Closure $listener + * @param \Closure|string $listener * @param bool $wildcard * @return \Closure * @static */ public static function makeListener($listener, $wildcard = false) { - return \Illuminate\Events\Dispatcher::makeListener($listener, $wildcard); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->makeListener($listener, $wildcard); } /** @@ -4136,7 +4942,8 @@ public static function makeListener($listener, $wildcard = false) */ public static function createClassListener($listener, $wildcard = false) { - return \Illuminate\Events\Dispatcher::createClassListener($listener, $wildcard); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->createClassListener($listener, $wildcard); } /** @@ -4148,7 +4955,8 @@ public static function createClassListener($listener, $wildcard = false) */ public static function forget($event) { - \Illuminate\Events\Dispatcher::forget($event); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->forget($event); } /** @@ -4159,23 +4967,99 @@ public static function forget($event) */ public static function forgetPushed() { - \Illuminate\Events\Dispatcher::forgetPushed(); + /** @var \Illuminate\Events\Dispatcher $instance */ + $instance->forgetPushed(); } /** * Set the queue resolver implementation. * * @param callable $resolver - * @return $this + * @return \Illuminate\Events\Dispatcher * @static */ public static function setQueueResolver($resolver) { - return \Illuminate\Events\Dispatcher::setQueueResolver($resolver); + /** @var \Illuminate\Events\Dispatcher $instance */ + return $instance->setQueueResolver($resolver); + } + + /** + * Assert if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|int|null $callback + * @return void + * @static + */ + public static function assertDispatched($event, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\EventFake $instance */ + $instance->assertDispatched($event, $callback); + } + + /** + * Assert if a event was dispatched a number of times. + * + * @param string $event + * @param int $times + * @return void + * @static + */ + public static function assertDispatchedTimes($event, $times = 1) + { + /** @var \Illuminate\Support\Testing\Fakes\EventFake $instance */ + $instance->assertDispatchedTimes($event, $times); + } + + /** + * Determine if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return void + * @static + */ + public static function assertNotDispatched($event, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\EventFake $instance */ + $instance->assertNotDispatched($event, $callback); + } + + /** + * Get all of the events matching a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return \Illuminate\Support\Collection + * @static + */ + public static function dispatched($event, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\EventFake $instance */ + return $instance->dispatched($event, $callback); + } + + /** + * Determine if the given event has been dispatched. + * + * @param string $event + * @return bool + * @static + */ + public static function hasDispatched($event) + { + /** @var \Illuminate\Support\Testing\Fakes\EventFake $instance */ + return $instance->hasDispatched($event); } } + /** + * + * + * @see \Illuminate\Filesystem\Filesystem + */ class File { /** @@ -4187,7 +5071,8 @@ class File { */ public static function exists($path) { - return \Illuminate\Filesystem\Filesystem::exists($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->exists($path); } /** @@ -4201,7 +5086,8 @@ public static function exists($path) */ public static function get($path, $lock = false) { - return \Illuminate\Filesystem\Filesystem::get($path, $lock); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->get($path, $lock); } /** @@ -4213,7 +5099,8 @@ public static function get($path, $lock = false) */ public static function sharedGet($path) { - return \Illuminate\Filesystem\Filesystem::sharedGet($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->sharedGet($path); } /** @@ -4226,7 +5113,8 @@ public static function sharedGet($path) */ public static function getRequire($path) { - return \Illuminate\Filesystem\Filesystem::getRequire($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->getRequire($path); } /** @@ -4238,7 +5126,8 @@ public static function getRequire($path) */ public static function requireOnce($file) { - return \Illuminate\Filesystem\Filesystem::requireOnce($file); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->requireOnce($file); } /** @@ -4250,7 +5139,8 @@ public static function requireOnce($file) */ public static function hash($path) { - return \Illuminate\Filesystem\Filesystem::hash($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->hash($path); } /** @@ -4264,7 +5154,8 @@ public static function hash($path) */ public static function put($path, $contents, $lock = false) { - return \Illuminate\Filesystem\Filesystem::put($path, $contents, $lock); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->put($path, $contents, $lock); } /** @@ -4277,7 +5168,8 @@ public static function put($path, $contents, $lock = false) */ public static function prepend($path, $data) { - return \Illuminate\Filesystem\Filesystem::prepend($path, $data); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->prepend($path, $data); } /** @@ -4290,7 +5182,8 @@ public static function prepend($path, $data) */ public static function append($path, $data) { - return \Illuminate\Filesystem\Filesystem::append($path, $data); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->append($path, $data); } /** @@ -4303,7 +5196,8 @@ public static function append($path, $data) */ public static function chmod($path, $mode = null) { - return \Illuminate\Filesystem\Filesystem::chmod($path, $mode); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->chmod($path, $mode); } /** @@ -4315,7 +5209,8 @@ public static function chmod($path, $mode = null) */ public static function delete($paths) { - return \Illuminate\Filesystem\Filesystem::delete($paths); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->delete($paths); } /** @@ -4328,7 +5223,8 @@ public static function delete($paths) */ public static function move($path, $target) { - return \Illuminate\Filesystem\Filesystem::move($path, $target); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->move($path, $target); } /** @@ -4341,7 +5237,8 @@ public static function move($path, $target) */ public static function copy($path, $target) { - return \Illuminate\Filesystem\Filesystem::copy($path, $target); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->copy($path, $target); } /** @@ -4354,7 +5251,8 @@ public static function copy($path, $target) */ public static function link($target, $link) { - \Illuminate\Filesystem\Filesystem::link($target, $link); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + $instance->link($target, $link); } /** @@ -4366,7 +5264,8 @@ public static function link($target, $link) */ public static function name($path) { - return \Illuminate\Filesystem\Filesystem::name($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->name($path); } /** @@ -4378,7 +5277,8 @@ public static function name($path) */ public static function basename($path) { - return \Illuminate\Filesystem\Filesystem::basename($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->basename($path); } /** @@ -4390,7 +5290,8 @@ public static function basename($path) */ public static function dirname($path) { - return \Illuminate\Filesystem\Filesystem::dirname($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->dirname($path); } /** @@ -4402,7 +5303,8 @@ public static function dirname($path) */ public static function extension($path) { - return \Illuminate\Filesystem\Filesystem::extension($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->extension($path); } /** @@ -4414,7 +5316,8 @@ public static function extension($path) */ public static function type($path) { - return \Illuminate\Filesystem\Filesystem::type($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->type($path); } /** @@ -4426,7 +5329,8 @@ public static function type($path) */ public static function mimeType($path) { - return \Illuminate\Filesystem\Filesystem::mimeType($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->mimeType($path); } /** @@ -4438,7 +5342,8 @@ public static function mimeType($path) */ public static function size($path) { - return \Illuminate\Filesystem\Filesystem::size($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->size($path); } /** @@ -4450,7 +5355,8 @@ public static function size($path) */ public static function lastModified($path) { - return \Illuminate\Filesystem\Filesystem::lastModified($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->lastModified($path); } /** @@ -4462,7 +5368,8 @@ public static function lastModified($path) */ public static function isDirectory($directory) { - return \Illuminate\Filesystem\Filesystem::isDirectory($directory); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->isDirectory($directory); } /** @@ -4474,7 +5381,8 @@ public static function isDirectory($directory) */ public static function isReadable($path) { - return \Illuminate\Filesystem\Filesystem::isReadable($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->isReadable($path); } /** @@ -4486,7 +5394,8 @@ public static function isReadable($path) */ public static function isWritable($path) { - return \Illuminate\Filesystem\Filesystem::isWritable($path); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->isWritable($path); } /** @@ -4498,7 +5407,8 @@ public static function isWritable($path) */ public static function isFile($file) { - return \Illuminate\Filesystem\Filesystem::isFile($file); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->isFile($file); } /** @@ -4511,19 +5421,22 @@ public static function isFile($file) */ public static function glob($pattern, $flags = 0) { - return \Illuminate\Filesystem\Filesystem::glob($pattern, $flags); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->glob($pattern, $flags); } /** * Get an array of all files in a directory. * * @param string $directory - * @return array + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] * @static */ - public static function files($directory) + public static function files($directory, $hidden = false) { - return \Illuminate\Filesystem\Filesystem::files($directory); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->files($directory, $hidden); } /** @@ -4531,12 +5444,13 @@ public static function files($directory) * * @param string $directory * @param bool $hidden - * @return array + * @return \Symfony\Component\Finder\SplFileInfo[] * @static */ public static function allFiles($directory, $hidden = false) { - return \Illuminate\Filesystem\Filesystem::allFiles($directory, $hidden); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->allFiles($directory, $hidden); } /** @@ -4548,7 +5462,8 @@ public static function allFiles($directory, $hidden = false) */ public static function directories($directory) { - return \Illuminate\Filesystem\Filesystem::directories($directory); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->directories($directory); } /** @@ -4563,7 +5478,8 @@ public static function directories($directory) */ public static function makeDirectory($path, $mode = 493, $recursive = false, $force = false) { - return \Illuminate\Filesystem\Filesystem::makeDirectory($path, $mode, $recursive, $force); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->makeDirectory($path, $mode, $recursive, $force); } /** @@ -4577,7 +5493,8 @@ public static function makeDirectory($path, $mode = 493, $recursive = false, $fo */ public static function moveDirectory($from, $to, $overwrite = false) { - return \Illuminate\Filesystem\Filesystem::moveDirectory($from, $to, $overwrite); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->moveDirectory($from, $to, $overwrite); } /** @@ -4591,7 +5508,8 @@ public static function moveDirectory($from, $to, $overwrite = false) */ public static function copyDirectory($directory, $destination, $options = null) { - return \Illuminate\Filesystem\Filesystem::copyDirectory($directory, $destination, $options); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->copyDirectory($directory, $destination, $options); } /** @@ -4606,7 +5524,21 @@ public static function copyDirectory($directory, $destination, $options = null) */ public static function deleteDirectory($directory, $preserve = false) { - return \Illuminate\Filesystem\Filesystem::deleteDirectory($directory, $preserve); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->deleteDirectory($directory, $preserve); + } + + /** + * Remove all of the directories within a given directory. + * + * @param string $directory + * @return bool + * @static + */ + public static function deleteDirectories($directory) + { + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->deleteDirectories($directory); } /** @@ -4618,20 +5550,34 @@ public static function deleteDirectory($directory, $preserve = false) */ public static function cleanDirectory($directory) { - return \Illuminate\Filesystem\Filesystem::cleanDirectory($directory); + /** @var \Illuminate\Filesystem\Filesystem $instance */ + return $instance->cleanDirectory($directory); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Filesystem\Filesystem::macro($name, $macro); + \Illuminate\Filesystem\Filesystem::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Filesystem\Filesystem::mixin($mixin); } /** @@ -4643,23 +5589,29 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Filesystem\Filesystem::hasMacro($name); + return \Illuminate\Filesystem\Filesystem::hasMacro($name); } } + /** + * + * + * @see \Illuminate\Contracts\Auth\Access\Gate + */ class Gate { /** * Determine if a given ability has been defined. * - * @param string $ability + * @param string|array $ability * @return bool * @static */ public static function has($ability) { - return \Illuminate\Auth\Access\Gate::has($ability); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->has($ability); } /** @@ -4667,13 +5619,14 @@ public static function has($ability) * * @param string $ability * @param callable|string $callback - * @return $this + * @return \Illuminate\Auth\Access\Gate * @throws \InvalidArgumentException * @static */ public static function define($ability, $callback) { - return \Illuminate\Auth\Access\Gate::define($ability, $callback); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->define($ability, $callback); } /** @@ -4681,13 +5634,14 @@ public static function define($ability, $callback) * * @param string $name * @param string $class - * @param array $abilities - * @return $this + * @param array|null $abilities + * @return \Illuminate\Auth\Access\Gate * @static */ public static function resource($name, $class, $abilities = null) { - return \Illuminate\Auth\Access\Gate::resource($name, $class, $abilities); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->resource($name, $class, $abilities); } /** @@ -4695,36 +5649,39 @@ public static function resource($name, $class, $abilities = null) * * @param string $class * @param string $policy - * @return $this + * @return \Illuminate\Auth\Access\Gate * @static */ public static function policy($class, $policy) { - return \Illuminate\Auth\Access\Gate::policy($class, $policy); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->policy($class, $policy); } /** * Register a callback to run before all Gate checks. * * @param callable $callback - * @return $this + * @return \Illuminate\Auth\Access\Gate * @static */ public static function before($callback) { - return \Illuminate\Auth\Access\Gate::before($callback); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->before($callback); } /** * Register a callback to run after all Gate checks. * * @param callable $callback - * @return $this + * @return \Illuminate\Auth\Access\Gate * @static */ public static function after($callback) { - return \Illuminate\Auth\Access\Gate::after($callback); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->after($callback); } /** @@ -4737,7 +5694,8 @@ public static function after($callback) */ public static function allows($ability, $arguments = array()) { - return \Illuminate\Auth\Access\Gate::allows($ability, $arguments); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->allows($ability, $arguments); } /** @@ -4750,20 +5708,36 @@ public static function allows($ability, $arguments = array()) */ public static function denies($ability, $arguments = array()) { - return \Illuminate\Auth\Access\Gate::denies($ability, $arguments); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->denies($ability, $arguments); } /** - * Determine if the given ability should be granted for the current user. + * Determine if all of the given abilities should be granted for the current user. * - * @param string $ability + * @param \Illuminate\Auth\Access\iterable|string $abilities + * @param array|mixed $arguments + * @return bool + * @static + */ + public static function check($abilities, $arguments = array()) + { + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->check($abilities, $arguments); + } + + /** + * Determine if any one of the given abilities should be granted for the current user. + * + * @param \Illuminate\Auth\Access\iterable|string $abilities * @param array|mixed $arguments * @return bool * @static */ - public static function check($ability, $arguments = array()) + public static function any($abilities, $arguments = array()) { - return \Illuminate\Auth\Access\Gate::check($ability, $arguments); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->any($abilities, $arguments); } /** @@ -4777,7 +5751,8 @@ public static function check($ability, $arguments = array()) */ public static function authorize($ability, $arguments = array()) { - return \Illuminate\Auth\Access\Gate::authorize($ability, $arguments); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->authorize($ability, $arguments); } /** @@ -4789,7 +5764,8 @@ public static function authorize($ability, $arguments = array()) */ public static function getPolicyFor($class) { - return \Illuminate\Auth\Access\Gate::getPolicyFor($class); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->getPolicyFor($class); } /** @@ -4801,7 +5777,8 @@ public static function getPolicyFor($class) */ public static function resolvePolicy($class) { - return \Illuminate\Auth\Access\Gate::resolvePolicy($class); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->resolvePolicy($class); } /** @@ -4813,7 +5790,8 @@ public static function resolvePolicy($class) */ public static function forUser($user) { - return \Illuminate\Auth\Access\Gate::forUser($user); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->forUser($user); } /** @@ -4824,25 +5802,80 @@ public static function forUser($user) */ public static function abilities() { - return \Illuminate\Auth\Access\Gate::abilities(); + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->abilities(); } - - } - - class Hash { /** - * Hash the given value. + * Get all of the defined policies. * - * @param string $value + * @return array + * @static + */ + public static function policies() + { + /** @var \Illuminate\Auth\Access\Gate $instance */ + return $instance->policies(); + } + + } + + /** + * + * + * @see \Illuminate\Hashing\HashManager + */ + class Hash { + + /** + * Create an instance of the Bcrypt hash Driver. + * + * @return \Illuminate\Hashing\BcryptHasher + * @static + */ + public static function createBcryptDriver() + { + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->createBcryptDriver(); + } + + /** + * Create an instance of the Argon2 hash Driver. + * + * @return \Illuminate\Hashing\ArgonHasher + * @static + */ + public static function createArgonDriver() + { + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->createArgonDriver(); + } + + /** + * Get information about the given hashed value. + * + * @param string $hashedValue + * @return array + * @static + */ + public static function info($hashedValue) + { + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->info($hashedValue); + } + + /** + * Hash the given value. + * + * @param string $value * @param array $options * @return string - * @throws \RuntimeException * @static */ public static function make($value, $options = array()) { - return \Illuminate\Hashing\BcryptHasher::make($value, $options); + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->make($value, $options); } /** @@ -4856,7 +5889,8 @@ public static function make($value, $options = array()) */ public static function check($value, $hashedValue, $options = array()) { - return \Illuminate\Hashing\BcryptHasher::check($value, $hashedValue, $options); + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->check($value, $hashedValue, $options); } /** @@ -4869,23 +5903,72 @@ public static function check($value, $hashedValue, $options = array()) */ public static function needsRehash($hashedValue, $options = array()) { - return \Illuminate\Hashing\BcryptHasher::needsRehash($hashedValue, $options); + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->needsRehash($hashedValue, $options); + } + + /** + * Get the default driver name. + * + * @return string + * @static + */ + public static function getDefaultDriver() + { + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->getDefaultDriver(); + } + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + * @throws \InvalidArgumentException + * @static + */ + public static function driver($driver = null) + { + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->driver($driver); + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return \Illuminate\Hashing\HashManager + * @static + */ + public static function extend($driver, $callback) + { + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->extend($driver, $callback); } /** - * Set the default password work factor. + * Get all of the created "drivers". * - * @param int $rounds - * @return $this + * @return array * @static */ - public static function setRounds($rounds) + public static function getDrivers() { - return \Illuminate\Hashing\BcryptHasher::setRounds($rounds); + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Hashing\HashManager $instance */ + return $instance->getDrivers(); } } + /** + * + * + * @see \Illuminate\Translation\Translator + */ class Lang { /** @@ -4898,7 +5981,8 @@ class Lang { */ public static function hasForLocale($key, $locale = null) { - return \Illuminate\Translation\Translator::hasForLocale($key, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->hasForLocale($key, $locale); } /** @@ -4912,7 +5996,8 @@ public static function hasForLocale($key, $locale = null) */ public static function has($key, $locale = null, $fallback = true) { - return \Illuminate\Translation\Translator::has($key, $locale, $fallback); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->has($key, $locale, $fallback); } /** @@ -4926,7 +6011,8 @@ public static function has($key, $locale = null, $fallback = true) */ public static function trans($key, $replace = array(), $locale = null) { - return \Illuminate\Translation\Translator::trans($key, $replace, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->trans($key, $replace, $locale); } /** @@ -4941,7 +6027,8 @@ public static function trans($key, $replace = array(), $locale = null) */ public static function get($key, $replace = array(), $locale = null, $fallback = true) { - return \Illuminate\Translation\Translator::get($key, $replace, $locale, $fallback); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->get($key, $replace, $locale, $fallback); } /** @@ -4950,12 +6037,13 @@ public static function get($key, $replace = array(), $locale = null, $fallback = * @param string $key * @param array $replace * @param string $locale - * @return string + * @return string|array|null * @static */ public static function getFromJson($key, $replace = array(), $locale = null) { - return \Illuminate\Translation\Translator::getFromJson($key, $replace, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->getFromJson($key, $replace, $locale); } /** @@ -4970,7 +6058,8 @@ public static function getFromJson($key, $replace = array(), $locale = null) */ public static function transChoice($key, $number, $replace = array(), $locale = null) { - return \Illuminate\Translation\Translator::transChoice($key, $number, $replace, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->transChoice($key, $number, $replace, $locale); } /** @@ -4985,7 +6074,8 @@ public static function transChoice($key, $number, $replace = array(), $locale = */ public static function choice($key, $number, $replace = array(), $locale = null) { - return \Illuminate\Translation\Translator::choice($key, $number, $replace, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->choice($key, $number, $replace, $locale); } /** @@ -4999,7 +6089,8 @@ public static function choice($key, $number, $replace = array(), $locale = null) */ public static function addLines($lines, $locale, $namespace = '*') { - \Illuminate\Translation\Translator::addLines($lines, $locale, $namespace); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->addLines($lines, $locale, $namespace); } /** @@ -5013,7 +6104,8 @@ public static function addLines($lines, $locale, $namespace = '*') */ public static function load($namespace, $group, $locale) { - \Illuminate\Translation\Translator::load($namespace, $group, $locale); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->load($namespace, $group, $locale); } /** @@ -5026,7 +6118,21 @@ public static function load($namespace, $group, $locale) */ public static function addNamespace($namespace, $hint) { - \Illuminate\Translation\Translator::addNamespace($namespace, $hint); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->addNamespace($namespace, $hint); + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + * @static + */ + public static function addJsonPath($path) + { + /** @var \Illuminate\Translation\Translator $instance */ + $instance->addJsonPath($path); } /** @@ -5038,7 +6144,8 @@ public static function addNamespace($namespace, $hint) */ public static function parseKey($key) { - return \Illuminate\Translation\Translator::parseKey($key); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->parseKey($key); } /** @@ -5049,7 +6156,8 @@ public static function parseKey($key) */ public static function getSelector() { - return \Illuminate\Translation\Translator::getSelector(); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->getSelector(); } /** @@ -5061,18 +6169,20 @@ public static function getSelector() */ public static function setSelector($selector) { - \Illuminate\Translation\Translator::setSelector($selector); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->setSelector($selector); } /** * Get the language line loader implementation. * - * @return \Illuminate\Translation\LoaderInterface + * @return \Illuminate\Contracts\Translation\Loader * @static */ public static function getLoader() { - return \Illuminate\Translation\Translator::getLoader(); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->getLoader(); } /** @@ -5083,7 +6193,8 @@ public static function getLoader() */ public static function locale() { - return \Illuminate\Translation\Translator::locale(); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->locale(); } /** @@ -5094,7 +6205,8 @@ public static function locale() */ public static function getLocale() { - return \Illuminate\Translation\Translator::getLocale(); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->getLocale(); } /** @@ -5106,7 +6218,8 @@ public static function getLocale() */ public static function setLocale($locale) { - \Illuminate\Translation\Translator::setLocale($locale); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->setLocale($locale); } /** @@ -5117,7 +6230,8 @@ public static function setLocale($locale) */ public static function getFallback() { - return \Illuminate\Translation\Translator::getFallback(); + /** @var \Illuminate\Translation\Translator $instance */ + return $instance->getFallback(); } /** @@ -5129,7 +6243,21 @@ public static function getFallback() */ public static function setFallback($fallback) { - \Illuminate\Translation\Translator::setFallback($fallback); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->setFallback($fallback); + } + + /** + * Set the loaded translation groups. + * + * @param array $loaded + * @return void + * @static + */ + public static function setLoaded($loaded) + { + /** @var \Illuminate\Translation\Translator $instance */ + $instance->setLoaded($loaded); } /** @@ -5143,20 +6271,34 @@ public static function setFallback($fallback) public static function setParsedKey($key, $parsed) { //Method inherited from \Illuminate\Support\NamespacedItemResolver - \Illuminate\Translation\Translator::setParsedKey($key, $parsed); + /** @var \Illuminate\Translation\Translator $instance */ + $instance->setParsedKey($key, $parsed); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Translation\Translator::macro($name, $macro); + \Illuminate\Translation\Translator::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Translation\Translator::mixin($mixin); } /** @@ -5168,11 +6310,16 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Translation\Translator::hasMacro($name); + return \Illuminate\Translation\Translator::hasMacro($name); } } + /** + * + * + * @see \Illuminate\Log\Logger + */ class Log { /** @@ -5180,12 +6327,13 @@ class Log { * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function debug($message, $context = array()) { - return \Monolog\Logger::debug($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addDebug($message, $context); } /** @@ -5193,12 +6341,13 @@ public static function debug($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function info($message, $context = array()) { - return \Monolog\Logger::info($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addInfo($message, $context); } /** @@ -5206,12 +6355,13 @@ public static function info($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function notice($message, $context = array()) { - return \Monolog\Logger::notice($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addNotice($message, $context); } /** @@ -5219,12 +6369,13 @@ public static function notice($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function warning($message, $context = array()) { - return \Monolog\Logger::warning($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addWarning($message, $context); } /** @@ -5232,12 +6383,13 @@ public static function warning($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function error($message, $context = array()) { - return \Monolog\Logger::error($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addError($message, $context); } /** @@ -5245,12 +6397,13 @@ public static function error($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function critical($message, $context = array()) { - return \Monolog\Logger::critical($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addCritical($message, $context); } /** @@ -5258,12 +6411,13 @@ public static function critical($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function alert($message, $context = array()) { - return \Monolog\Logger::alert($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addAlert($message, $context); } /** @@ -5271,145 +6425,116 @@ public static function alert($message, $context = array()) * * @param string $message The log message * @param array $context The log context - * @return Boolean Whether the record has been processed + * @return bool Whether the record has been processed * @static */ public static function emergency($message, $context = array()) { - return \Monolog\Logger::emergency($message, $context); + /** @var \Monolog\Logger $instance */ + return $instance->addEmergency($message, $context); } /** - * Log a message to the logs. + * Create a new, on-demand aggregate logger instance. * - * @param string $level - * @param string $message - * @param array $context - * @return void + * @param array $channels + * @param string|null $channel + * @return \Psr\Log\LoggerInterface * @static */ - public static function log($level, $message, $context = array()) + public static function stack($channels, $channel = null) { - \Illuminate\Log\Writer::log($level, $message, $context); + /** @var \Illuminate\Log\LogManager $instance */ + return $instance->stack($channels, $channel); } /** - * Dynamically pass log calls into the writer. + * Get a log channel instance. * - * @param string $level - * @param string $message - * @param array $context - * @return void + * @param string|null $channel + * @return mixed * @static */ - public static function write($level, $message, $context = array()) + public static function channel($channel = null) { - \Illuminate\Log\Writer::write($level, $message, $context); + /** @var \Illuminate\Log\LogManager $instance */ + return $instance->channel($channel); } /** - * Register a file log handler. + * Get a log driver instance. * - * @param string $path - * @param string $level - * @return void + * @param string|null $driver + * @return mixed * @static */ - public static function useFiles($path, $level = 'debug') + public static function driver($driver = null) { - \Illuminate\Log\Writer::useFiles($path, $level); + /** @var \Illuminate\Log\LogManager $instance */ + return $instance->driver($driver); } /** - * Register a daily file log handler. + * Get the default log driver name. * - * @param string $path - * @param int $days - * @param string $level - * @return void + * @return string * @static */ - public static function useDailyFiles($path, $days = 0, $level = 'debug') + public static function getDefaultDriver() { - \Illuminate\Log\Writer::useDailyFiles($path, $days, $level); + /** @var \Illuminate\Log\LogManager $instance */ + return $instance->getDefaultDriver(); } /** - * Register a Syslog handler. + * Set the default log driver name. * * @param string $name - * @param string $level - * @param mixed $facility - * @return \Psr\Log\LoggerInterface - * @static - */ - public static function useSyslog($name = 'laravel', $level = 'debug', $facility = 8) - { - return \Illuminate\Log\Writer::useSyslog($name, $level, $facility); - } - - /** - * Register an error_log handler. - * - * @param string $level - * @param int $messageType * @return void * @static */ - public static function useErrorLog($level = 'debug', $messageType = 0) + public static function setDefaultDriver($name) { - \Illuminate\Log\Writer::useErrorLog($level, $messageType); + /** @var \Illuminate\Log\LogManager $instance */ + $instance->setDefaultDriver($name); } /** - * Register a new callback handler for when a log event is triggered. + * Register a custom driver creator Closure. * + * @param string $driver * @param \Closure $callback - * @return void - * @throws \RuntimeException - * @static - */ - public static function listen($callback) - { - \Illuminate\Log\Writer::listen($callback); - } - - /** - * Get the underlying Monolog instance. - * - * @return \Monolog\Logger - * @static - */ - public static function getMonolog() - { - return \Illuminate\Log\Writer::getMonolog(); - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Contracts\Events\Dispatcher + * @return \Illuminate\Log\LogManager * @static */ - public static function getEventDispatcher() + public static function extend($driver, $callback) { - return \Illuminate\Log\Writer::getEventDispatcher(); + /** @var \Illuminate\Log\LogManager $instance */ + return $instance->extend($driver, $callback); } /** - * Set the event dispatcher instance. + * Logs with an arbitrary level. * - * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @param mixed $level + * @param string $message + * @param array $context * @return void * @static */ - public static function setEventDispatcher($dispatcher) + public static function log($level, $message, $context = array()) { - \Illuminate\Log\Writer::setEventDispatcher($dispatcher); + /** @var \Illuminate\Log\LogManager $instance */ + $instance->log($level, $message, $context); } } + /** + * + * + * @see \Illuminate\Mail\Mailer + */ class Mail { /** @@ -5422,7 +6547,8 @@ class Mail { */ public static function alwaysFrom($address, $name = null) { - \Illuminate\Mail\Mailer::alwaysFrom($address, $name); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->alwaysFrom($address, $name); } /** @@ -5435,7 +6561,8 @@ public static function alwaysFrom($address, $name = null) */ public static function alwaysReplyTo($address, $name = null) { - \Illuminate\Mail\Mailer::alwaysReplyTo($address, $name); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->alwaysReplyTo($address, $name); } /** @@ -5448,7 +6575,8 @@ public static function alwaysReplyTo($address, $name = null) */ public static function alwaysTo($address, $name = null) { - \Illuminate\Mail\Mailer::alwaysTo($address, $name); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->alwaysTo($address, $name); } /** @@ -5460,7 +6588,8 @@ public static function alwaysTo($address, $name = null) */ public static function to($users) { - return \Illuminate\Mail\Mailer::to($users); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->to($users); } /** @@ -5472,7 +6601,22 @@ public static function to($users) */ public static function bcc($users) { - return \Illuminate\Mail\Mailer::bcc($users); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->bcc($users); + } + + /** + * Send a new message with only an HTML part. + * + * @param string $html + * @param mixed $callback + * @return void + * @static + */ + public static function html($html, $callback) + { + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->html($html, $callback); } /** @@ -5485,7 +6629,8 @@ public static function bcc($users) */ public static function raw($text, $callback) { - \Illuminate\Mail\Mailer::raw($text, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->raw($text, $callback); } /** @@ -5499,36 +6644,51 @@ public static function raw($text, $callback) */ public static function plain($view, $data, $callback) { - \Illuminate\Mail\Mailer::plain($view, $data, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->plain($view, $data, $callback); } /** - * Send a new message using a view. + * Render the given message as a view. * * @param string|array $view * @param array $data + * @return string + * @static + */ + public static function render($view, $data = array()) + { + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->render($view, $data); + } + + /** + * Send a new message using a view. + * + * @param string|array|\Illuminate\Mail\MailableContract $view + * @param array $data * @param \Closure|string $callback * @return void * @static */ public static function send($view, $data = array(), $callback = null) { - \Illuminate\Mail\Mailer::send($view, $data, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->send($view, $data, $callback); } /** * Queue a new e-mail message for sending. * - * @param string|array $view - * @param array $data - * @param \Closure|string $callback + * @param string|array|\Illuminate\Mail\MailableContract $view * @param string|null $queue * @return mixed * @static */ - public static function queue($view, $data = array(), $callback = null, $queue = null) + public static function queue($view, $queue = null) { - return \Illuminate\Mail\Mailer::queue($view, $data, $callback, $queue); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->queue($view, $queue); } /** @@ -5536,14 +6696,13 @@ public static function queue($view, $data = array(), $callback = null, $queue = * * @param string $queue * @param string|array $view - * @param array $data - * @param \Closure|string $callback * @return mixed * @static */ - public static function onQueue($queue, $view, $data, $callback) + public static function onQueue($queue, $view) { - return \Illuminate\Mail\Mailer::onQueue($queue, $view, $data, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->onQueue($queue, $view); } /** @@ -5553,46 +6712,43 @@ public static function onQueue($queue, $view, $data, $callback) * * @param string $queue * @param string|array $view - * @param array $data - * @param \Closure|string $callback * @return mixed * @static */ - public static function queueOn($queue, $view, $data, $callback) + public static function queueOn($queue, $view) { - return \Illuminate\Mail\Mailer::queueOn($queue, $view, $data, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->queueOn($queue, $view); } /** * Queue a new e-mail message for sending after (n) seconds. * - * @param int $delay - * @param string|array $view - * @param array $data - * @param \Closure|string $callback + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string|array|\Illuminate\Mail\MailableContract $view * @param string|null $queue * @return mixed * @static */ - public static function later($delay, $view, $data = array(), $callback = null, $queue = null) + public static function later($delay, $view, $queue = null) { - return \Illuminate\Mail\Mailer::later($delay, $view, $data, $callback, $queue); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->later($delay, $view, $queue); } /** * Queue a new e-mail message for sending after (n) seconds on the given queue. * * @param string $queue - * @param int $delay + * @param \DateTimeInterface|\DateInterval|int $delay * @param string|array $view - * @param array $data - * @param \Closure|string $callback * @return mixed * @static */ - public static function laterOn($queue, $delay, $view, $data, $callback) + public static function laterOn($queue, $delay, $view) { - return \Illuminate\Mail\Mailer::laterOn($queue, $delay, $view, $data, $callback); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->laterOn($queue, $delay, $view); } /** @@ -5603,7 +6759,8 @@ public static function laterOn($queue, $delay, $view, $data, $callback) */ public static function getViewFactory() { - return \Illuminate\Mail\Mailer::getViewFactory(); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->getViewFactory(); } /** @@ -5614,7 +6771,8 @@ public static function getViewFactory() */ public static function getSwiftMailer() { - return \Illuminate\Mail\Mailer::getSwiftMailer(); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->getSwiftMailer(); } /** @@ -5625,7 +6783,8 @@ public static function getSwiftMailer() */ public static function failures() { - return \Illuminate\Mail\Mailer::failures(); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->failures(); } /** @@ -5637,32 +6796,47 @@ public static function failures() */ public static function setSwiftMailer($swift) { - \Illuminate\Mail\Mailer::setSwiftMailer($swift); + /** @var \Illuminate\Mail\Mailer $instance */ + $instance->setSwiftMailer($swift); } /** * Set the queue manager instance. * * @param \Illuminate\Contracts\Queue\Factory $queue - * @return $this + * @return \Illuminate\Mail\Mailer * @static */ public static function setQueue($queue) { - return \Illuminate\Mail\Mailer::setQueue($queue); + /** @var \Illuminate\Mail\Mailer $instance */ + return $instance->setQueue($queue); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Mail\Mailer::macro($name, $macro); + \Illuminate\Mail\Mailer::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Mail\Mailer::mixin($mixin); } /** @@ -5674,139 +6848,398 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Mail\Mailer::hasMacro($name); + return \Illuminate\Mail\Mailer::hasMacro($name); } - - } - - class Notification { /** - * Send the given notification to the given notifiable entities. + * Assert if a mailable was sent based on a truth-test callback. * - * @param \Illuminate\Support\Collection|array|mixed $notifiables - * @param mixed $notification + * @param string $mailable + * @param callable|int|null $callback * @return void * @static */ - public static function send($notifiables, $notification) + public static function assertSent($mailable, $callback = null) { - \Illuminate\Notifications\ChannelManager::send($notifiables, $notification); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertSent($mailable, $callback); } /** - * Send the given notification immediately. + * Determine if a mailable was not sent based on a truth-test callback. * - * @param \Illuminate\Support\Collection|array|mixed $notifiables - * @param mixed $notification - * @param array|null $channels + * @param string $mailable + * @param callable|null $callback * @return void * @static */ - public static function sendNow($notifiables, $notification, $channels = null) + public static function assertNotSent($mailable, $callback = null) { - \Illuminate\Notifications\ChannelManager::sendNow($notifiables, $notification, $channels); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertNotSent($mailable, $callback); } /** - * Get a channel instance. + * Assert that no mailables were sent. * - * @param string|null $name - * @return mixed + * @return void * @static */ - public static function channel($name = null) + public static function assertNothingSent() { - return \Illuminate\Notifications\ChannelManager::channel($name); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertNothingSent(); } /** - * Get the default channel driver name. + * Assert if a mailable was queued based on a truth-test callback. * - * @return string + * @param string $mailable + * @param callable|int|null $callback + * @return void * @static */ - public static function getDefaultDriver() + public static function assertQueued($mailable, $callback = null) { - return \Illuminate\Notifications\ChannelManager::getDefaultDriver(); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertQueued($mailable, $callback); } /** - * Get the default channel driver name. + * Determine if a mailable was not queued based on a truth-test callback. * - * @return string + * @param string $mailable + * @param callable|null $callback + * @return void * @static */ - public static function deliversVia() + public static function assertNotQueued($mailable, $callback = null) { - return \Illuminate\Notifications\ChannelManager::deliversVia(); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertNotQueued($mailable, $callback); } /** - * Set the default channel driver name. + * Assert that no mailables were queued. * - * @param string $channel * @return void * @static */ - public static function deliverVia($channel) + public static function assertNothingQueued() { - \Illuminate\Notifications\ChannelManager::deliverVia($channel); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + $instance->assertNothingQueued(); } /** - * Get a driver instance. + * Get all of the mailables matching a truth-test callback. * - * @param string $driver - * @return mixed + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection * @static */ - public static function driver($driver = null) + public static function sent($mailable, $callback = null) { - //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Notifications\ChannelManager::driver($driver); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + return $instance->sent($mailable, $callback); } /** - * Register a custom driver creator Closure. + * Determine if the given mailable has been sent. * - * @param string $driver - * @param \Closure $callback - * @return $this + * @param string $mailable + * @return bool * @static */ - public static function extend($driver, $callback) + public static function hasSent($mailable) { - //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Notifications\ChannelManager::extend($driver, $callback); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + return $instance->hasSent($mailable); } /** - * Get all of the created "drivers". + * Get all of the queued mailables matching a truth-test callback. * - * @return array + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection * @static */ - public static function getDrivers() + public static function queued($mailable, $callback = null) { - //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Notifications\ChannelManager::getDrivers(); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + return $instance->queued($mailable, $callback); } - - } - - class Password { /** - * Attempt to get the broker from the local cache. + * Determine if the given mailable has been queued. * - * @param string $name - * @return \Illuminate\Contracts\Auth\PasswordBroker + * @param string $mailable + * @return bool * @static */ - public static function broker($name = null) + public static function hasQueued($mailable) { - return \Illuminate\Auth\Passwords\PasswordBrokerManager::broker($name); + /** @var \Illuminate\Support\Testing\Fakes\MailFake $instance */ + return $instance->hasQueued($mailable); + } + + } + + /** + * + * + * @see \Illuminate\Notifications\ChannelManager + */ + class Notification { + + /** + * Send the given notification to the given notifiable entities. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + * @static + */ + public static function send($notifiables, $notification) + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + $instance->send($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array|null $channels + * @return void + * @static + */ + public static function sendNow($notifiables, $notification, $channels = null) + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + $instance->sendNow($notifiables, $notification, $channels); + } + + /** + * Get a channel instance. + * + * @param string|null $name + * @return mixed + * @static + */ + public static function channel($name = null) + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->channel($name); + } + + /** + * Get the default channel driver name. + * + * @return string + * @static + */ + public static function getDefaultDriver() + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->getDefaultDriver(); + } + + /** + * Get the default channel driver name. + * + * @return string + * @static + */ + public static function deliversVia() + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->deliversVia(); + } + + /** + * Set the default channel driver name. + * + * @param string $channel + * @return void + * @static + */ + public static function deliverVia($channel) + { + /** @var \Illuminate\Notifications\ChannelManager $instance */ + $instance->deliverVia($channel); + } + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + * @throws \InvalidArgumentException + * @static + */ + public static function driver($driver = null) + { + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->driver($driver); + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return \Illuminate\Notifications\ChannelManager + * @static + */ + public static function extend($driver, $callback) + { + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->extend($driver, $callback); + } + + /** + * Get all of the created "drivers". + * + * @return array + * @static + */ + public static function getDrivers() + { + //Method inherited from \Illuminate\Support\Manager + /** @var \Illuminate\Notifications\ChannelManager $instance */ + return $instance->getDrivers(); + } + + /** + * Assert if a notification was sent based on a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return void + * @static + */ + public static function assertSentTo($notifiable, $notification, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + $instance->assertSentTo($notifiable, $notification, $callback); + } + + /** + * Assert if a notification was sent a number of times. + * + * @param mixed $notifiable + * @param string $notification + * @param int $times + * @return void + * @static + */ + public static function assertSentToTimes($notifiable, $notification, $times = 1) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + $instance->assertSentToTimes($notifiable, $notification, $times); + } + + /** + * Determine if a notification was sent based on a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return void + * @static + */ + public static function assertNotSentTo($notifiable, $notification, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + $instance->assertNotSentTo($notifiable, $notification, $callback); + } + + /** + * Assert that no notifications were sent. + * + * @return void + * @static + */ + public static function assertNothingSent() + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + $instance->assertNothingSent(); + } + + /** + * Assert the total amount of times a notification was sent. + * + * @param int $expectedCount + * @param string $notification + * @return void + * @static + */ + public static function assertTimesSent($expectedCount, $notification) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + $instance->assertTimesSent($expectedCount, $notification); + } + + /** + * Get all of the notifications matching a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return \Illuminate\Support\Collection + * @static + */ + public static function sent($notifiable, $notification, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + return $instance->sent($notifiable, $notification, $callback); + } + + /** + * Determine if there are more notifications left to inspect. + * + * @param mixed $notifiable + * @param string $notification + * @return bool + * @static + */ + public static function hasSent($notifiable, $notification) + { + /** @var \Illuminate\Support\Testing\Fakes\NotificationFake $instance */ + return $instance->hasSent($notifiable, $notification); + } + + } + + /** + * + * + * @method static string sendResetLink(array $credentials) + * @method static mixed reset(array $credentials, \Closure $callback) + * @method static void validator(\Closure $callback) + * @method static bool validateNewPassword(array $credentials) + * @see \Illuminate\Auth\Passwords\PasswordBroker + */ + class Password { + + /** + * Attempt to get the broker from the local cache. + * + * @param string|null $name + * @return \Illuminate\Contracts\Auth\PasswordBroker + * @static + */ + public static function broker($name = null) + { + /** @var \Illuminate\Auth\Passwords\PasswordBrokerManager $instance */ + return $instance->broker($name); } /** @@ -5817,7 +7250,8 @@ public static function broker($name = null) */ public static function getDefaultDriver() { - return \Illuminate\Auth\Passwords\PasswordBrokerManager::getDefaultDriver(); + /** @var \Illuminate\Auth\Passwords\PasswordBrokerManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -5829,11 +7263,18 @@ public static function getDefaultDriver() */ public static function setDefaultDriver($name) { - \Illuminate\Auth\Passwords\PasswordBrokerManager::setDefaultDriver($name); + /** @var \Illuminate\Auth\Passwords\PasswordBrokerManager $instance */ + $instance->setDefaultDriver($name); } } + /** + * + * + * @see \Illuminate\Queue\QueueManager + * @see \Illuminate\Queue\Queue + */ class Queue { /** @@ -5845,7 +7286,8 @@ class Queue { */ public static function before($callback) { - \Illuminate\Queue\QueueManager::before($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->before($callback); } /** @@ -5857,7 +7299,8 @@ public static function before($callback) */ public static function after($callback) { - \Illuminate\Queue\QueueManager::after($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->after($callback); } /** @@ -5869,7 +7312,8 @@ public static function after($callback) */ public static function exceptionOccurred($callback) { - \Illuminate\Queue\QueueManager::exceptionOccurred($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->exceptionOccurred($callback); } /** @@ -5881,7 +7325,8 @@ public static function exceptionOccurred($callback) */ public static function looping($callback) { - \Illuminate\Queue\QueueManager::looping($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->looping($callback); } /** @@ -5893,7 +7338,8 @@ public static function looping($callback) */ public static function failing($callback) { - \Illuminate\Queue\QueueManager::failing($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->failing($callback); } /** @@ -5905,7 +7351,8 @@ public static function failing($callback) */ public static function stopping($callback) { - \Illuminate\Queue\QueueManager::stopping($callback); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->stopping($callback); } /** @@ -5917,7 +7364,8 @@ public static function stopping($callback) */ public static function connected($name = null) { - return \Illuminate\Queue\QueueManager::connected($name); + /** @var \Illuminate\Queue\QueueManager $instance */ + return $instance->connected($name); } /** @@ -5929,7 +7377,8 @@ public static function connected($name = null) */ public static function connection($name = null) { - return \Illuminate\Queue\QueueManager::connection($name); + /** @var \Illuminate\Queue\QueueManager $instance */ + return $instance->connection($name); } /** @@ -5942,7 +7391,8 @@ public static function connection($name = null) */ public static function extend($driver, $resolver) { - \Illuminate\Queue\QueueManager::extend($driver, $resolver); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->extend($driver, $resolver); } /** @@ -5955,7 +7405,8 @@ public static function extend($driver, $resolver) */ public static function addConnector($driver, $resolver) { - \Illuminate\Queue\QueueManager::addConnector($driver, $resolver); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->addConnector($driver, $resolver); } /** @@ -5966,7 +7417,8 @@ public static function addConnector($driver, $resolver) */ public static function getDefaultDriver() { - return \Illuminate\Queue\QueueManager::getDefaultDriver(); + /** @var \Illuminate\Queue\QueueManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -5978,7 +7430,8 @@ public static function getDefaultDriver() */ public static function setDefaultDriver($name) { - \Illuminate\Queue\QueueManager::setDefaultDriver($name); + /** @var \Illuminate\Queue\QueueManager $instance */ + $instance->setDefaultDriver($name); } /** @@ -5990,7 +7443,8 @@ public static function setDefaultDriver($name) */ public static function getName($connection = null) { - return \Illuminate\Queue\QueueManager::getName($connection); + /** @var \Illuminate\Queue\QueueManager $instance */ + return $instance->getName($connection); } /** @@ -6001,7 +7455,105 @@ public static function getName($connection = null) */ public static function isDownForMaintenance() { - return \Illuminate\Queue\QueueManager::isDownForMaintenance(); + /** @var \Illuminate\Queue\QueueManager $instance */ + return $instance->isDownForMaintenance(); + } + + /** + * Assert if a job was pushed based on a truth-test callback. + * + * @param string $job + * @param callable|int|null $callback + * @return void + * @static + */ + public static function assertPushed($job, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + $instance->assertPushed($job, $callback); + } + + /** + * Assert if a job was pushed based on a truth-test callback. + * + * @param string $queue + * @param string $job + * @param callable|null $callback + * @return void + * @static + */ + public static function assertPushedOn($queue, $job, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + $instance->assertPushedOn($queue, $job, $callback); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + * @static + */ + public static function assertPushedWithChain($job, $expectedChain = array(), $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + $instance->assertPushedWithChain($job, $expectedChain, $callback); + } + + /** + * Determine if a job was pushed based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + * @static + */ + public static function assertNotPushed($job, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + $instance->assertNotPushed($job, $callback); + } + + /** + * Assert that no jobs were pushed. + * + * @return void + * @static + */ + public static function assertNothingPushed() + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + $instance->assertNothingPushed(); + } + + /** + * Get all of the jobs matching a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return \Illuminate\Support\Collection + * @static + */ + public static function pushed($job, $callback = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->pushed($job, $callback); + } + + /** + * Determine if there are any stored jobs for a given class. + * + * @param string $job + * @return bool + * @static + */ + public static function hasPushed($job) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->hasPushed($job); } /** @@ -6013,7 +7565,8 @@ public static function isDownForMaintenance() */ public static function size($queue = null) { - return \Illuminate\Queue\SyncQueue::size($queue); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->size($queue); } /** @@ -6023,12 +7576,12 @@ public static function size($queue = null) * @param mixed $data * @param string $queue * @return mixed - * @throws \Exception|\Throwable * @static */ public static function push($job, $data = '', $queue = null) { - return \Illuminate\Queue\SyncQueue::push($job, $data, $queue); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->push($job, $data, $queue); } /** @@ -6042,7 +7595,8 @@ public static function push($job, $data = '', $queue = null) */ public static function pushRaw($payload, $queue = null, $options = array()) { - return \Illuminate\Queue\SyncQueue::pushRaw($payload, $queue, $options); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->pushRaw($payload, $queue, $options); } /** @@ -6057,19 +7611,8 @@ public static function pushRaw($payload, $queue = null, $options = array()) */ public static function later($delay, $job, $data = '', $queue = null) { - return \Illuminate\Queue\SyncQueue::later($delay, $job, $data, $queue); - } - - /** - * Pop the next job off of the queue. - * - * @param string $queue - * @return \Illuminate\Contracts\Queue\Job|null - * @static - */ - public static function pop($queue = null) - { - return \Illuminate\Queue\SyncQueue::pop($queue); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->later($delay, $job, $data, $queue); } /** @@ -6083,8 +7626,8 @@ public static function pop($queue = null) */ public static function pushOn($queue, $job, $data = '') { - //Method inherited from \Illuminate\Queue\Queue - return \Illuminate\Queue\SyncQueue::pushOn($queue, $job, $data); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->pushOn($queue, $job, $data); } /** @@ -6099,23 +7642,36 @@ public static function pushOn($queue, $job, $data = '') */ public static function laterOn($queue, $delay, $job, $data = '') { - //Method inherited from \Illuminate\Queue\Queue - return \Illuminate\Queue\SyncQueue::laterOn($queue, $delay, $job, $data); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->laterOn($queue, $delay, $job, $data); } /** - * Push an array of jobs onto the queue. + * Pop the next job off of the queue. * - * @param array $jobs - * @param mixed $data * @param string $queue - * @return mixed + * @return \Illuminate\Contracts\Queue\Job|null * @static */ - public static function bulk($jobs, $data = '', $queue = null) + public static function pop($queue = null) { - //Method inherited from \Illuminate\Queue\Queue - return \Illuminate\Queue\SyncQueue::bulk($jobs, $data, $queue); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->pop($queue); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return mixed + * @static + */ + public static function bulk($jobs, $data = '', $queue = null) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->bulk($jobs, $data, $queue); } /** @@ -6126,21 +7682,103 @@ public static function bulk($jobs, $data = '', $queue = null) */ public static function getConnectionName() { - //Method inherited from \Illuminate\Queue\Queue - return \Illuminate\Queue\SyncQueue::getConnectionName(); + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->getConnectionName(); } /** * Set the connection name for the queue. * * @param string $name - * @return $this + * @return \Illuminate\Support\Testing\Fakes\QueueFake * @static */ public static function setConnectionName($name) + { + /** @var \Illuminate\Support\Testing\Fakes\QueueFake $instance */ + return $instance->setConnectionName($name); + } + + /** + * Migrate the delayed jobs that are ready to the regular queue. + * + * @param string $from + * @param string $to + * @return array + * @static + */ + public static function migrateExpiredJobs($from, $to) + { + /** @var \Illuminate\Queue\RedisQueue $instance */ + return $instance->migrateExpiredJobs($from, $to); + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @return void + * @static + */ + public static function deleteReserved($queue, $job) + { + /** @var \Illuminate\Queue\RedisQueue $instance */ + $instance->deleteReserved($queue, $job); + } + + /** + * Delete a reserved job from the reserved queue and release it. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @param int $delay + * @return void + * @static + */ + public static function deleteAndRelease($queue, $job, $delay) + { + /** @var \Illuminate\Queue\RedisQueue $instance */ + $instance->deleteAndRelease($queue, $job, $delay); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + * @static + */ + public static function getQueue($queue) + { + /** @var \Illuminate\Queue\RedisQueue $instance */ + return $instance->getQueue($queue); + } + + /** + * Get the underlying Redis instance. + * + * @return \Illuminate\Contracts\Redis\Factory + * @static + */ + public static function getRedis() + { + /** @var \Illuminate\Queue\RedisQueue $instance */ + return $instance->getRedis(); + } + + /** + * Get the expiration timestamp for an object-based queue handler. + * + * @param mixed $job + * @return mixed + * @static + */ + public static function getJobExpiration($job) { //Method inherited from \Illuminate\Queue\Queue - return \Illuminate\Queue\SyncQueue::setConnectionName($name); + /** @var \Illuminate\Queue\RedisQueue $instance */ + return $instance->getJobExpiration($job); } /** @@ -6153,11 +7791,17 @@ public static function setConnectionName($name) public static function setContainer($container) { //Method inherited from \Illuminate\Queue\Queue - \Illuminate\Queue\SyncQueue::setContainer($container); + /** @var \Illuminate\Queue\RedisQueue $instance */ + $instance->setContainer($container); } } + /** + * + * + * @see \Illuminate\Routing\Redirector + */ class Redirect { /** @@ -6169,7 +7813,8 @@ class Redirect { */ public static function home($status = 302) { - return \Illuminate\Routing\Redirector::home($status); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->home($status); } /** @@ -6183,7 +7828,8 @@ public static function home($status = 302) */ public static function back($status = 302, $headers = array(), $fallback = false) { - return \Illuminate\Routing\Redirector::back($status, $headers, $fallback); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->back($status, $headers, $fallback); } /** @@ -6196,7 +7842,8 @@ public static function back($status = 302, $headers = array(), $fallback = false */ public static function refresh($status = 302, $headers = array()) { - return \Illuminate\Routing\Redirector::refresh($status, $headers); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->refresh($status, $headers); } /** @@ -6211,7 +7858,8 @@ public static function refresh($status = 302, $headers = array()) */ public static function guest($path, $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\Redirector::guest($path, $status, $headers, $secure); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->guest($path, $status, $headers, $secure); } /** @@ -6226,7 +7874,8 @@ public static function guest($path, $status = 302, $headers = array(), $secure = */ public static function intended($default = '/', $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\Redirector::intended($default, $status, $headers, $secure); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->intended($default, $status, $headers, $secure); } /** @@ -6241,7 +7890,8 @@ public static function intended($default = '/', $status = 302, $headers = array( */ public static function to($path, $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\Redirector::to($path, $status, $headers, $secure); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->to($path, $status, $headers, $secure); } /** @@ -6255,7 +7905,8 @@ public static function to($path, $status = 302, $headers = array(), $secure = nu */ public static function away($path, $status = 302, $headers = array()) { - return \Illuminate\Routing\Redirector::away($path, $status, $headers); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->away($path, $status, $headers); } /** @@ -6269,14 +7920,15 @@ public static function away($path, $status = 302, $headers = array()) */ public static function secure($path, $status = 302, $headers = array()) { - return \Illuminate\Routing\Redirector::secure($path, $status, $headers); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->secure($path, $status, $headers); } /** * Create a new redirect response to a named route. * * @param string $route - * @param array $parameters + * @param mixed $parameters * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse @@ -6284,14 +7936,15 @@ public static function secure($path, $status = 302, $headers = array()) */ public static function route($route, $parameters = array(), $status = 302, $headers = array()) { - return \Illuminate\Routing\Redirector::route($route, $parameters, $status, $headers); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->route($route, $parameters, $status, $headers); } /** * Create a new redirect response to a controller action. * * @param string $action - * @param array $parameters + * @param mixed $parameters * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse @@ -6299,7 +7952,8 @@ public static function route($route, $parameters = array(), $status = 302, $head */ public static function action($action, $parameters = array(), $status = 302, $headers = array()) { - return \Illuminate\Routing\Redirector::action($action, $parameters, $status, $headers); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->action($action, $parameters, $status, $headers); } /** @@ -6310,7 +7964,8 @@ public static function action($action, $parameters = array(), $status = 302, $he */ public static function getUrlGenerator() { - return \Illuminate\Routing\Redirector::getUrlGenerator(); + /** @var \Illuminate\Routing\Redirector $instance */ + return $instance->getUrlGenerator(); } /** @@ -6322,11 +7977,104 @@ public static function getUrlGenerator() */ public static function setSession($session) { - \Illuminate\Routing\Redirector::setSession($session); + /** @var \Illuminate\Routing\Redirector $instance */ + $instance->setSession($session); + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * @return void + * @static + */ + public static function macro($name, $macro) + { + \Illuminate\Routing\Redirector::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Routing\Redirector::mixin($mixin); + } + + /** + * Checks if macro is registered. + * + * @param string $name + * @return bool + * @static + */ + public static function hasMacro($name) + { + return \Illuminate\Routing\Redirector::hasMacro($name); + } + + } + + /** + * + * + * @see \Illuminate\Redis\RedisManager + * @see \Illuminate\Contracts\Redis\Factory + */ + class Redis { + + /** + * Get a Redis connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + * @static + */ + public static function connection($name = null) + { + /** @var \Illuminate\Redis\RedisManager $instance */ + return $instance->connection($name); + } + + /** + * Resolve the given connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + * @throws \InvalidArgumentException + * @static + */ + public static function resolve($name = null) + { + /** @var \Illuminate\Redis\RedisManager $instance */ + return $instance->resolve($name); + } + + /** + * Return all of the created connections. + * + * @return array + * @static + */ + public static function connections() + { + /** @var \Illuminate\Redis\RedisManager $instance */ + return $instance->connections(); } } + /** + * + * + * @see \Illuminate\Http\Request + */ class Request { /** @@ -6337,18 +8085,19 @@ class Request { */ public static function capture() { - return \Illuminate\Http\Request::capture(); + return \Illuminate\Http\Request::capture(); } /** * Return the Request instance. * - * @return $this + * @return \Illuminate\Http\Request * @static */ public static function instance() { - return \Illuminate\Http\Request::instance(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->instance(); } /** @@ -6359,7 +8108,8 @@ public static function instance() */ public static function method() { - return \Illuminate\Http\Request::method(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->method(); } /** @@ -6370,7 +8120,8 @@ public static function method() */ public static function root() { - return \Illuminate\Http\Request::root(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->root(); } /** @@ -6381,7 +8132,8 @@ public static function root() */ public static function url() { - return \Illuminate\Http\Request::url(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->url(); } /** @@ -6392,7 +8144,8 @@ public static function url() */ public static function fullUrl() { - return \Illuminate\Http\Request::fullUrl(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->fullUrl(); } /** @@ -6404,7 +8157,8 @@ public static function fullUrl() */ public static function fullUrlWithQuery($query) { - return \Illuminate\Http\Request::fullUrlWithQuery($query); + /** @var \Illuminate\Http\Request $instance */ + return $instance->fullUrlWithQuery($query); } /** @@ -6415,18 +8169,20 @@ public static function fullUrlWithQuery($query) */ public static function path() { - return \Illuminate\Http\Request::path(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->path(); } /** - * Get the current encoded path info for the request. + * Get the current decoded path info for the request. * * @return string * @static */ public static function decodedPath() { - return \Illuminate\Http\Request::decodedPath(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->decodedPath(); } /** @@ -6439,7 +8195,8 @@ public static function decodedPath() */ public static function segment($index, $default = null) { - return \Illuminate\Http\Request::segment($index, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->segment($index, $default); } /** @@ -6450,41 +8207,47 @@ public static function segment($index, $default = null) */ public static function segments() { - return \Illuminate\Http\Request::segments(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->segments(); } /** * Determine if the current request URI matches a pattern. * + * @param mixed $patterns * @return bool * @static */ - public static function is() + public static function is($patterns = null) { - return \Illuminate\Http\Request::is(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->is($patterns); } /** - * Check if the route name matches the given string. + * Determine if the route name matches a given pattern. * - * @param string $name + * @param mixed $patterns * @return bool * @static */ - public static function routeIs($name) + public static function routeIs($patterns = null) { - return \Illuminate\Http\Request::routeIs($name); + /** @var \Illuminate\Http\Request $instance */ + return $instance->routeIs($patterns); } /** * Determine if the current request URL and query string matches a pattern. * + * @param mixed $patterns * @return bool * @static */ - public static function fullUrlIs() + public static function fullUrlIs($patterns = null) { - return \Illuminate\Http\Request::fullUrlIs(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->fullUrlIs($patterns); } /** @@ -6495,7 +8258,8 @@ public static function fullUrlIs() */ public static function ajax() { - return \Illuminate\Http\Request::ajax(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->ajax(); } /** @@ -6506,7 +8270,8 @@ public static function ajax() */ public static function pjax() { - return \Illuminate\Http\Request::pjax(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->pjax(); } /** @@ -6517,66 +8282,113 @@ public static function pjax() */ public static function secure() { - return \Illuminate\Http\Request::secure(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->secure(); } /** - * Returns the client IP address. + * Get the client IP address. * * @return string * @static */ public static function ip() { - return \Illuminate\Http\Request::ip(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->ip(); } /** - * Returns the client IP addresses. + * Get the client IP addresses. * * @return array * @static */ public static function ips() { - return \Illuminate\Http\Request::ips(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->ips(); + } + + /** + * Get the client user agent. + * + * @return string + * @static + */ + public static function userAgent() + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->userAgent(); } /** * Merge new input into the current request's input array. * * @param array $input - * @return void + * @return \Illuminate\Http\Request * @static */ public static function merge($input) { - \Illuminate\Http\Request::merge($input); + /** @var \Illuminate\Http\Request $instance */ + return $instance->merge($input); } /** * Replace the input for the current request. * * @param array $input - * @return void + * @return \Illuminate\Http\Request * @static */ public static function replace($input) { - \Illuminate\Http\Request::replace($input); + /** @var \Illuminate\Http\Request $instance */ + return $instance->replace($input); } /** - * Get the JSON payload for the request. + * This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel. + * + * Instead, you may use the "input" method. * * @param string $key * @param mixed $default * @return mixed * @static */ + public static function get($key, $default = null) + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->get($key, $default); + } + + /** + * Get the JSON payload for the request. + * + * @param string $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed + * @static + */ public static function json($key = null, $default = null) { - return \Illuminate\Http\Request::json($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->json($key, $default); + } + + /** + * Create a new request instance from the given Laravel request. + * + * @param \Illuminate\Http\Request $from + * @param \Illuminate\Http\Request|null $to + * @return static + * @static + */ + public static function createFrom($from, $to = null) + { + return \Illuminate\Http\Request::createFrom($from, $to); } /** @@ -6588,7 +8400,7 @@ public static function json($key = null, $default = null) */ public static function createFromBase($request) { - return \Illuminate\Http\Request::createFromBase($request); + return \Illuminate\Http\Request::createFromBase($request); } /** @@ -6605,7 +8417,8 @@ public static function createFromBase($request) */ public static function duplicate($query = null, $request = null, $attributes = null, $cookies = null, $files = null, $server = null) { - return \Illuminate\Http\Request::duplicate($query, $request, $attributes, $cookies, $files, $server); + /** @var \Illuminate\Http\Request $instance */ + return $instance->duplicate($query, $request, $attributes, $cookies, $files, $server); } /** @@ -6617,7 +8430,20 @@ public static function duplicate($query = null, $request = null, $attributes = n */ public static function session() { - return \Illuminate\Http\Request::session(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->session(); + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store|null + * @static + */ + public static function getSession() + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->getSession(); } /** @@ -6629,7 +8455,8 @@ public static function session() */ public static function setLaravelSession($session) { - \Illuminate\Http\Request::setLaravelSession($session); + /** @var \Illuminate\Http\Request $instance */ + $instance->setLaravelSession($session); } /** @@ -6641,7 +8468,8 @@ public static function setLaravelSession($session) */ public static function user($guard = null) { - return \Illuminate\Http\Request::user($guard); + /** @var \Illuminate\Http\Request $instance */ + return $instance->user($guard); } /** @@ -6653,7 +8481,8 @@ public static function user($guard = null) */ public static function route($param = null) { - return \Illuminate\Http\Request::route($param); + /** @var \Illuminate\Http\Request $instance */ + return $instance->route($param); } /** @@ -6665,19 +8494,21 @@ public static function route($param = null) */ public static function fingerprint() { - return \Illuminate\Http\Request::fingerprint(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->fingerprint(); } /** * Set the JSON payload for the request. * - * @param array $json - * @return $this + * @param \Symfony\Component\HttpFoundation\ParameterBag $json + * @return \Illuminate\Http\Request * @static */ public static function setJson($json) { - return \Illuminate\Http\Request::setJson($json); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setJson($json); } /** @@ -6688,19 +8519,21 @@ public static function setJson($json) */ public static function getUserResolver() { - return \Illuminate\Http\Request::getUserResolver(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getUserResolver(); } /** * Set the user resolver callback. * * @param \Closure $callback - * @return $this + * @return \Illuminate\Http\Request * @static */ public static function setUserResolver($callback) { - return \Illuminate\Http\Request::setUserResolver($callback); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setUserResolver($callback); } /** @@ -6711,19 +8544,21 @@ public static function setUserResolver($callback) */ public static function getRouteResolver() { - return \Illuminate\Http\Request::getRouteResolver(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getRouteResolver(); } /** * Set the route resolver callback. * * @param \Closure $callback - * @return $this + * @return \Illuminate\Http\Request * @static */ public static function setRouteResolver($callback) { - return \Illuminate\Http\Request::setRouteResolver($callback); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setRouteResolver($callback); } /** @@ -6734,7 +8569,8 @@ public static function setRouteResolver($callback) */ public static function toArray() { - return \Illuminate\Http\Request::toArray(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->toArray(); } /** @@ -6746,7 +8582,8 @@ public static function toArray() */ public static function offsetExists($offset) { - return \Illuminate\Http\Request::offsetExists($offset); + /** @var \Illuminate\Http\Request $instance */ + return $instance->offsetExists($offset); } /** @@ -6758,7 +8595,8 @@ public static function offsetExists($offset) */ public static function offsetGet($offset) { - return \Illuminate\Http\Request::offsetGet($offset); + /** @var \Illuminate\Http\Request $instance */ + return $instance->offsetGet($offset); } /** @@ -6771,7 +8609,8 @@ public static function offsetGet($offset) */ public static function offsetSet($offset, $value) { - \Illuminate\Http\Request::offsetSet($offset, $value); + /** @var \Illuminate\Http\Request $instance */ + $instance->offsetSet($offset, $value); } /** @@ -6783,7 +8622,8 @@ public static function offsetSet($offset, $value) */ public static function offsetUnset($offset) { - \Illuminate\Http\Request::offsetUnset($offset); + /** @var \Illuminate\Http\Request $instance */ + $instance->offsetUnset($offset); } /** @@ -6797,13 +8637,14 @@ public static function offsetUnset($offset) * @param array $cookies The COOKIE parameters * @param array $files The FILES parameters * @param array $server The SERVER parameters - * @param string|resource $content The raw body data + * @param string|resource|null $content The raw body data * @static */ public static function initialize($query = array(), $request = array(), $attributes = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::initialize($query, $request, $attributes, $cookies, $files, $server, $content); + /** @var \Illuminate\Http\Request $instance */ + return $instance->initialize($query, $request, $attributes, $cookies, $files, $server, $content); } /** @@ -6815,7 +8656,7 @@ public static function initialize($query = array(), $request = array(), $attribu public static function createFromGlobals() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::createFromGlobals(); + return \Illuminate\Http\Request::createFromGlobals(); } /** @@ -6830,14 +8671,14 @@ public static function createFromGlobals() * @param array $cookies The request cookies ($_COOKIE) * @param array $files The request files ($_FILES) * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data + * @param string|resource|null $content The raw body data * @return static * @static */ public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::create($uri, $method, $parameters, $cookies, $files, $server, $content); + return \Illuminate\Http\Request::create($uri, $method, $parameters, $cookies, $files, $server, $content); } /** @@ -6853,7 +8694,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo public static function setFactory($callable) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setFactory($callable); + return \Illuminate\Http\Request::setFactory($callable); } /** @@ -6867,7 +8708,8 @@ public static function setFactory($callable) public static function overrideGlobals() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::overrideGlobals(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->overrideGlobals(); } /** @@ -6880,10 +8722,10 @@ public static function overrideGlobals() * @throws \InvalidArgumentException When $trustedHeaderSet is invalid * @static */ - public static function setTrustedProxies($proxies) + public static function setTrustedProxies($proxies, $trustedHeaderSet) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setTrustedProxies($proxies); + return \Illuminate\Http\Request::setTrustedProxies($proxies, $trustedHeaderSet); } /** @@ -6895,7 +8737,7 @@ public static function setTrustedProxies($proxies) public static function getTrustedProxies() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getTrustedProxies(); + return \Illuminate\Http\Request::getTrustedProxies(); } /** @@ -6907,7 +8749,7 @@ public static function getTrustedProxies() public static function getTrustedHeaderSet() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getTrustedHeaderSet(); + return \Illuminate\Http\Request::getTrustedHeaderSet(); } /** @@ -6921,7 +8763,7 @@ public static function getTrustedHeaderSet() public static function setTrustedHosts($hostPatterns) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setTrustedHosts($hostPatterns); + return \Illuminate\Http\Request::setTrustedHosts($hostPatterns); } /** @@ -6933,47 +8775,7 @@ public static function setTrustedHosts($hostPatterns) public static function getTrustedHosts() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getTrustedHosts(); - } - - /** - * Sets the name for trusted headers. - * - * The following header keys are supported: - * - * * Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp()) - * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost()) - * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort()) - * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure()) - * * Request::HEADER_FORWARDED: defaults to Forwarded (see RFC 7239) - * - * Setting an empty value allows to disable the trusted header for the given key. - * - * @param string $key The header key - * @param string $value The header name - * @throws \InvalidArgumentException - * @deprecated since version 3.3, to be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead. - * @static - */ - public static function setTrustedHeaderName($key, $value) - { - //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setTrustedHeaderName($key, $value); - } - - /** - * Gets the trusted proxy header name. - * - * @param string $key The header key - * @return string The header name - * @throws \InvalidArgumentException - * @deprecated since version 3.3, to be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead. - * @static - */ - public static function getTrustedHeaderName($key) - { - //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getTrustedHeaderName($key); + return \Illuminate\Http\Request::getTrustedHosts(); } /** @@ -6989,7 +8791,7 @@ public static function getTrustedHeaderName($key) public static function normalizeQueryString($qs) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::normalizeQueryString($qs); + return \Illuminate\Http\Request::normalizeQueryString($qs); } /** @@ -7008,7 +8810,7 @@ public static function normalizeQueryString($qs) public static function enableHttpMethodParameterOverride() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::enableHttpMethodParameterOverride(); + return \Illuminate\Http\Request::enableHttpMethodParameterOverride(); } /** @@ -7020,39 +8822,7 @@ public static function enableHttpMethodParameterOverride() public static function getHttpMethodParameterOverride() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getHttpMethodParameterOverride(); - } - - /** - * Gets a "parameter" value from any bag. - * - * This method is mainly useful for libraries that want to provide some flexibility. If you don't need the - * flexibility in controllers, it is better to explicitly get request parameters from the appropriate - * public property instead (attributes, query, request). - * - * Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY - * - * @param string $key the key - * @param mixed $default the default value if the parameter key does not exist - * @return mixed - * @static - */ - public static function get($key, $default = null) - { - //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::get($key, $default); - } - - /** - * Gets the Session. - * - * @return \Symfony\Component\HttpFoundation\SessionInterface|null The session - * @static - */ - public static function getSession() - { - //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getSession(); + return \Illuminate\Http\Request::getHttpMethodParameterOverride(); } /** @@ -7065,7 +8835,8 @@ public static function getSession() public static function hasPreviousSession() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::hasPreviousSession(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasPreviousSession(); } /** @@ -7081,7 +8852,8 @@ public static function hasPreviousSession() public static function hasSession() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::hasSession(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasSession(); } /** @@ -7093,7 +8865,21 @@ public static function hasSession() public static function setSession($session) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setSession($session); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setSession($session); + } + + /** + * + * + * @internal + * @static + */ + public static function setSessionFactory($factory) + { + //Method inherited from \Symfony\Component\HttpFoundation\Request + /** @var \Illuminate\Http\Request $instance */ + return $instance->setSessionFactory($factory); } /** @@ -7112,7 +8898,8 @@ public static function setSession($session) public static function getClientIps() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getClientIps(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getClientIps(); } /** @@ -7123,10 +8910,6 @@ public static function getClientIps() * header value is a comma+space separated list of IP addresses, the left-most * being the original client, and each successive proxy that passed the request * adding the IP address where it received the request from. - * - * If your reverse proxy uses a different header name than "X-Forwarded-For", - * ("Client-Ip" for instance), configure it via the $trustedHeaderSet - * argument of the Request::setTrustedProxies() method instead. * * @return string|null The client IP address * @see getClientIps() @@ -7136,7 +8919,8 @@ public static function getClientIps() public static function getClientIp() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getClientIp(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getClientIp(); } /** @@ -7148,7 +8932,8 @@ public static function getClientIp() public static function getScriptName() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getScriptName(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getScriptName(); } /** @@ -7169,7 +8954,8 @@ public static function getScriptName() public static function getPathInfo() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getPathInfo(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getPathInfo(); } /** @@ -7188,7 +8974,8 @@ public static function getPathInfo() public static function getBasePath() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getBasePath(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getBasePath(); } /** @@ -7205,7 +8992,8 @@ public static function getBasePath() public static function getBaseUrl() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getBaseUrl(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getBaseUrl(); } /** @@ -7217,7 +9005,8 @@ public static function getBaseUrl() public static function getScheme() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getScheme(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getScheme(); } /** @@ -7227,10 +9016,6 @@ public static function getScheme() * when trusted proxies were set via "setTrustedProxies()". * * The "X-Forwarded-Port" header must contain the client port. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Port", - * configure it via via the $trustedHeaderSet argument of the - * Request::setTrustedProxies() method instead. * * @return int|string can be a string if fetched from the server bag * @static @@ -7238,7 +9023,8 @@ public static function getScheme() public static function getPort() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getPort(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getPort(); } /** @@ -7250,7 +9036,8 @@ public static function getPort() public static function getUser() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getUser(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getUser(); } /** @@ -7262,7 +9049,8 @@ public static function getUser() public static function getPassword() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getPassword(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getPassword(); } /** @@ -7274,7 +9062,8 @@ public static function getPassword() public static function getUserInfo() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getUserInfo(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getUserInfo(); } /** @@ -7288,7 +9077,8 @@ public static function getUserInfo() public static function getHttpHost() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getHttpHost(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getHttpHost(); } /** @@ -7300,7 +9090,8 @@ public static function getHttpHost() public static function getRequestUri() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getRequestUri(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getRequestUri(); } /** @@ -7315,7 +9106,8 @@ public static function getRequestUri() public static function getSchemeAndHttpHost() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getSchemeAndHttpHost(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getSchemeAndHttpHost(); } /** @@ -7328,7 +9120,8 @@ public static function getSchemeAndHttpHost() public static function getUri() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getUri(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getUri(); } /** @@ -7341,7 +9134,8 @@ public static function getUri() public static function getUriForPath($path) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getUriForPath($path); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getUriForPath($path); } /** @@ -7366,7 +9160,8 @@ public static function getUriForPath($path) public static function getRelativeUriForPath($path) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getRelativeUriForPath($path); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getRelativeUriForPath($path); } /** @@ -7381,7 +9176,8 @@ public static function getRelativeUriForPath($path) public static function getQueryString() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getQueryString(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getQueryString(); } /** @@ -7391,10 +9187,6 @@ public static function getQueryString() * when trusted proxies were set via "setTrustedProxies()". * * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http". - * - * If your reverse proxy uses a different header name than "X-Forwarded-Proto" - * ("SSL_HTTPS" for instance), configure it via the $trustedHeaderSet - * argument of the Request::setTrustedProxies() method instead. * * @return bool * @static @@ -7402,7 +9194,8 @@ public static function getQueryString() public static function isSecure() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isSecure(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isSecure(); } /** @@ -7412,10 +9205,6 @@ public static function isSecure() * when trusted proxies were set via "setTrustedProxies()". * * The "X-Forwarded-Host" header must contain the client host name. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Host", - * configure it via the $trustedHeaderSet argument of the - * Request::setTrustedProxies() method instead. * * @return string * @throws SuspiciousOperationException when the host name is invalid or not trusted @@ -7424,7 +9213,8 @@ public static function isSecure() public static function getHost() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getHost(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getHost(); } /** @@ -7436,7 +9226,8 @@ public static function getHost() public static function setMethod($method) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setMethod($method); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setMethod($method); } /** @@ -7457,7 +9248,8 @@ public static function setMethod($method) public static function getMethod() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getMethod(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getMethod(); } /** @@ -7470,20 +9262,22 @@ public static function getMethod() public static function getRealMethod() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getRealMethod(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getRealMethod(); } /** * Gets the mime type associated with the format. * * @param string $format The format - * @return string The associated mime type (null if not found) + * @return string|null The associated mime type (null if not found) * @static */ public static function getMimeType($format) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getMimeType($format); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getMimeType($format); } /** @@ -7496,7 +9290,7 @@ public static function getMimeType($format) public static function getMimeTypes($format) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getMimeTypes($format); + return \Illuminate\Http\Request::getMimeTypes($format); } /** @@ -7509,7 +9303,8 @@ public static function getMimeTypes($format) public static function getFormat($mimeType) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getFormat($mimeType); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getFormat($mimeType); } /** @@ -7522,7 +9317,8 @@ public static function getFormat($mimeType) public static function setFormat($format, $mimeTypes) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setFormat($format, $mimeTypes); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setFormat($format, $mimeTypes); } /** @@ -7534,14 +9330,15 @@ public static function setFormat($format, $mimeTypes) * * _format request attribute * * $default * - * @param string $default The default format - * @return string The request format + * @param string|null $default The default format + * @return string|null The request format * @static */ public static function getRequestFormat($default = 'html') { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getRequestFormat($default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getRequestFormat($default); } /** @@ -7553,7 +9350,8 @@ public static function getRequestFormat($default = 'html') public static function setRequestFormat($format) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setRequestFormat($format); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setRequestFormat($format); } /** @@ -7565,7 +9363,8 @@ public static function setRequestFormat($format) public static function getContentType() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getContentType(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getContentType(); } /** @@ -7577,7 +9376,8 @@ public static function getContentType() public static function setDefaultLocale($locale) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setDefaultLocale($locale); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setDefaultLocale($locale); } /** @@ -7589,7 +9389,8 @@ public static function setDefaultLocale($locale) public static function getDefaultLocale() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getDefaultLocale(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getDefaultLocale(); } /** @@ -7601,7 +9402,8 @@ public static function getDefaultLocale() public static function setLocale($locale) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::setLocale($locale); + /** @var \Illuminate\Http\Request $instance */ + return $instance->setLocale($locale); } /** @@ -7613,7 +9415,8 @@ public static function setLocale($locale) public static function getLocale() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getLocale(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getLocale(); } /** @@ -7626,7 +9429,8 @@ public static function getLocale() public static function isMethod($method) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isMethod($method); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isMethod($method); } /** @@ -7640,7 +9444,8 @@ public static function isMethod($method) public static function isMethodSafe() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isMethodSafe(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isMethodSafe(); } /** @@ -7652,20 +9457,41 @@ public static function isMethodSafe() public static function isMethodIdempotent() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isMethodIdempotent(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isMethodIdempotent(); } /** * Checks whether the method is cacheable or not. * * @see https://tools.ietf.org/html/rfc7231#section-4.2.3 - * @return bool + * @return bool True for GET and HEAD, false otherwise * @static */ public static function isMethodCacheable() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isMethodCacheable(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isMethodCacheable(); + } + + /** + * Returns the protocol version. + * + * If the application is behind a proxy, the protocol version used in the + * requests between the client and the proxy and between the proxy and the + * server might be different. This returns the former (from the "Via" header) + * if the proxy is trusted (see "setTrustedProxies()"), otherwise it returns + * the latter (from the "SERVER_PROTOCOL" server parameter). + * + * @return string + * @static + */ + public static function getProtocolVersion() + { + //Method inherited from \Symfony\Component\HttpFoundation\Request + /** @var \Illuminate\Http\Request $instance */ + return $instance->getProtocolVersion(); } /** @@ -7679,7 +9505,8 @@ public static function isMethodCacheable() public static function getContent($asResource = false) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getContent($asResource); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getContent($asResource); } /** @@ -7691,7 +9518,8 @@ public static function getContent($asResource = false) public static function getETags() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getETags(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getETags(); } /** @@ -7703,7 +9531,8 @@ public static function getETags() public static function isNoCache() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isNoCache(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isNoCache(); } /** @@ -7716,7 +9545,8 @@ public static function isNoCache() public static function getPreferredLanguage($locales = null) { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getPreferredLanguage($locales); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getPreferredLanguage($locales); } /** @@ -7728,7 +9558,8 @@ public static function getPreferredLanguage($locales = null) public static function getLanguages() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getLanguages(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getLanguages(); } /** @@ -7740,7 +9571,8 @@ public static function getLanguages() public static function getCharsets() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getCharsets(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getCharsets(); } /** @@ -7752,7 +9584,8 @@ public static function getCharsets() public static function getEncodings() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getEncodings(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getEncodings(); } /** @@ -7764,7 +9597,8 @@ public static function getEncodings() public static function getAcceptableContentTypes() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::getAcceptableContentTypes(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->getAcceptableContentTypes(); } /** @@ -7780,7 +9614,8 @@ public static function getAcceptableContentTypes() public static function isXmlHttpRequest() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isXmlHttpRequest(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isXmlHttpRequest(); } /** @@ -7795,7 +9630,8 @@ public static function isXmlHttpRequest() public static function isFromTrustedProxy() { //Method inherited from \Symfony\Component\HttpFoundation\Request - return \Illuminate\Http\Request::isFromTrustedProxy(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isFromTrustedProxy(); } /** @@ -7808,7 +9644,7 @@ public static function isFromTrustedProxy() */ public static function matchesType($actual, $type) { - return \Illuminate\Http\Request::matchesType($actual, $type); + return \Illuminate\Http\Request::matchesType($actual, $type); } /** @@ -7819,7 +9655,8 @@ public static function matchesType($actual, $type) */ public static function isJson() { - return \Illuminate\Http\Request::isJson(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->isJson(); } /** @@ -7830,18 +9667,20 @@ public static function isJson() */ public static function expectsJson() { - return \Illuminate\Http\Request::expectsJson(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->expectsJson(); } /** - * Determine if the current request is asking for JSON in return. + * Determine if the current request is asking for JSON. * * @return bool * @static */ public static function wantsJson() { - return \Illuminate\Http\Request::wantsJson(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->wantsJson(); } /** @@ -7853,7 +9692,8 @@ public static function wantsJson() */ public static function accepts($contentTypes) { - return \Illuminate\Http\Request::accepts($contentTypes); + /** @var \Illuminate\Http\Request $instance */ + return $instance->accepts($contentTypes); } /** @@ -7865,7 +9705,20 @@ public static function accepts($contentTypes) */ public static function prefers($contentTypes) { - return \Illuminate\Http\Request::prefers($contentTypes); + /** @var \Illuminate\Http\Request $instance */ + return $instance->prefers($contentTypes); + } + + /** + * Determine if the current request accepts any content type. + * + * @return bool + * @static + */ + public static function acceptsAnyContentType() + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->acceptsAnyContentType(); } /** @@ -7876,7 +9729,8 @@ public static function prefers($contentTypes) */ public static function acceptsJson() { - return \Illuminate\Http\Request::acceptsJson(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->acceptsJson(); } /** @@ -7887,7 +9741,8 @@ public static function acceptsJson() */ public static function acceptsHtml() { - return \Illuminate\Http\Request::acceptsHtml(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->acceptsHtml(); } /** @@ -7899,7 +9754,8 @@ public static function acceptsHtml() */ public static function format($default = 'html') { - return \Illuminate\Http\Request::format($default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->format($default); } /** @@ -7912,7 +9768,8 @@ public static function format($default = 'html') */ public static function old($key = null, $default = null) { - return \Illuminate\Http\Request::old($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->old($key, $default); } /** @@ -7923,7 +9780,8 @@ public static function old($key = null, $default = null) */ public static function flash() { - \Illuminate\Http\Request::flash(); + /** @var \Illuminate\Http\Request $instance */ + $instance->flash(); } /** @@ -7935,7 +9793,8 @@ public static function flash() */ public static function flashOnly($keys) { - \Illuminate\Http\Request::flashOnly($keys); + /** @var \Illuminate\Http\Request $instance */ + $instance->flashOnly($keys); } /** @@ -7947,7 +9806,8 @@ public static function flashOnly($keys) */ public static function flashExcept($keys) { - \Illuminate\Http\Request::flashExcept($keys); + /** @var \Illuminate\Http\Request $instance */ + $instance->flashExcept($keys); } /** @@ -7958,7 +9818,8 @@ public static function flashExcept($keys) */ public static function flush() { - \Illuminate\Http\Request::flush(); + /** @var \Illuminate\Http\Request $instance */ + $instance->flush(); } /** @@ -7971,7 +9832,8 @@ public static function flush() */ public static function server($key = null, $default = null) { - return \Illuminate\Http\Request::server($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->server($key, $default); } /** @@ -7983,7 +9845,8 @@ public static function server($key = null, $default = null) */ public static function hasHeader($key) { - return \Illuminate\Http\Request::hasHeader($key); + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasHeader($key); } /** @@ -7996,7 +9859,8 @@ public static function hasHeader($key) */ public static function header($key = null, $default = null) { - return \Illuminate\Http\Request::header($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->header($key, $default); } /** @@ -8007,7 +9871,8 @@ public static function header($key = null, $default = null) */ public static function bearerToken() { - return \Illuminate\Http\Request::bearerToken(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->bearerToken(); } /** @@ -8019,11 +9884,12 @@ public static function bearerToken() */ public static function exists($key) { - return \Illuminate\Http\Request::exists($key); + /** @var \Illuminate\Http\Request $instance */ + return $instance->exists($key); } /** - * Determine if the request contains a non-empty value for an input item. + * Determine if the request contains a given input item key. * * @param string|array $key * @return bool @@ -8031,31 +9897,86 @@ public static function exists($key) */ public static function has($key) { - return \Illuminate\Http\Request::has($key); + /** @var \Illuminate\Http\Request $instance */ + return $instance->has($key); + } + + /** + * Determine if the request contains any of the given inputs. + * + * @param string|array $keys + * @return bool + * @static + */ + public static function hasAny($keys) + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasAny($keys); + } + + /** + * Determine if the request contains a non-empty value for an input item. + * + * @param string|array $key + * @return bool + * @static + */ + public static function filled($key) + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->filled($key); + } + + /** + * Determine if the request contains a non-empty value for any of the given inputs. + * + * @param string|array $keys + * @return bool + * @static + */ + public static function anyFilled($keys) + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->anyFilled($keys); + } + + /** + * Get the keys for all of the input and files. + * + * @return array + * @static + */ + public static function keys() + { + /** @var \Illuminate\Http\Request $instance */ + return $instance->keys(); } /** * Get all of the input and files for the request. * + * @param array|mixed $keys * @return array * @static */ - public static function all() + public static function all($keys = null) { - return \Illuminate\Http\Request::all(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->all($keys); } /** * Retrieve an input item from the request. * - * @param string $key + * @param string|null $key * @param string|array|null $default - * @return string|array + * @return string|array|null * @static */ public static function input($key = null, $default = null) { - return \Illuminate\Http\Request::input($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->input($key, $default); } /** @@ -8067,7 +9988,8 @@ public static function input($key = null, $default = null) */ public static function only($keys) { - return \Illuminate\Http\Request::only($keys); + /** @var \Illuminate\Http\Request $instance */ + return $instance->only($keys); } /** @@ -8079,32 +10001,36 @@ public static function only($keys) */ public static function except($keys) { - return \Illuminate\Http\Request::except($keys); + /** @var \Illuminate\Http\Request $instance */ + return $instance->except($keys); } /** - * Intersect an array of items with the input data. + * Retrieve a query string item from the request. * - * @param array|mixed $keys - * @return array + * @param string $key + * @param string|array|null $default + * @return string|array * @static */ - public static function intersect($keys) + public static function query($key = null, $default = null) { - return \Illuminate\Http\Request::intersect($keys); + /** @var \Illuminate\Http\Request $instance */ + return $instance->query($key, $default); } /** - * Retrieve a query string item from the request. + * Retrieve a request payload item from the request. * * @param string $key * @param string|array|null $default * @return string|array * @static */ - public static function query($key = null, $default = null) + public static function post($key = null, $default = null) { - return \Illuminate\Http\Request::query($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->post($key, $default); } /** @@ -8116,7 +10042,8 @@ public static function query($key = null, $default = null) */ public static function hasCookie($key) { - return \Illuminate\Http\Request::hasCookie($key); + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasCookie($key); } /** @@ -8129,7 +10056,8 @@ public static function hasCookie($key) */ public static function cookie($key = null, $default = null) { - return \Illuminate\Http\Request::cookie($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->cookie($key, $default); } /** @@ -8140,7 +10068,8 @@ public static function cookie($key = null, $default = null) */ public static function allFiles() { - return \Illuminate\Http\Request::allFiles(); + /** @var \Illuminate\Http\Request $instance */ + return $instance->allFiles(); } /** @@ -8152,7 +10081,8 @@ public static function allFiles() */ public static function hasFile($key) { - return \Illuminate\Http\Request::hasFile($key); + /** @var \Illuminate\Http\Request $instance */ + return $instance->hasFile($key); } /** @@ -8165,20 +10095,34 @@ public static function hasFile($key) */ public static function file($key = null, $default = null) { - return \Illuminate\Http\Request::file($key, $default); + /** @var \Illuminate\Http\Request $instance */ + return $instance->file($key, $default); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Http\Request::macro($name, $macro); + \Illuminate\Http\Request::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Http\Request::mixin($mixin); } /** @@ -8190,11 +10134,36 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Http\Request::hasMacro($name); + return \Illuminate\Http\Request::hasMacro($name); + } + + /** + * + * + * @static + */ + public static function validate($rules, $params = null) + { + return \Illuminate\Http\Request::validate($rules, $params); + } + + /** + * + * + * @static + */ + public static function hasValidSignature() + { + return \Illuminate\Http\Request::hasValidSignature(); } } + /** + * + * + * @see \Illuminate\Contracts\Routing\ResponseFactory + */ class Response { /** @@ -8208,7 +10177,8 @@ class Response { */ public static function make($content = '', $status = 200, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::make($content, $status, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->make($content, $status, $headers); } /** @@ -8223,7 +10193,8 @@ public static function make($content = '', $status = 200, $headers = array()) */ public static function view($view, $data = array(), $status = 200, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::view($view, $data, $status, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->view($view, $data, $status, $headers); } /** @@ -8238,7 +10209,8 @@ public static function view($view, $data = array(), $status = 200, $headers = ar */ public static function json($data = array(), $status = 200, $headers = array(), $options = 0) { - return \Illuminate\Routing\ResponseFactory::json($data, $status, $headers, $options); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->json($data, $status, $headers, $options); } /** @@ -8254,7 +10226,8 @@ public static function json($data = array(), $status = 200, $headers = array(), */ public static function jsonp($callback, $data = array(), $status = 200, $headers = array(), $options = 0) { - return \Illuminate\Routing\ResponseFactory::jsonp($callback, $data, $status, $headers, $options); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->jsonp($callback, $data, $status, $headers, $options); } /** @@ -8268,14 +10241,31 @@ public static function jsonp($callback, $data = array(), $status = 200, $headers */ public static function stream($callback, $status = 200, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::stream($callback, $status, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->stream($callback, $status, $headers); + } + + /** + * Return a new streamed response as a file download from the application. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + * @static + */ + public static function streamDownload($callback, $name = null, $headers = array(), $disposition = 'attachment') + { + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->streamDownload($callback, $name, $headers, $disposition); } /** * Create a new file download response. * * @param \SplFileInfo|string $file - * @param string $name + * @param string|null $name * @param array $headers * @param string|null $disposition * @return \Symfony\Component\HttpFoundation\BinaryFileResponse @@ -8283,7 +10273,8 @@ public static function stream($callback, $status = 200, $headers = array()) */ public static function download($file, $name = null, $headers = array(), $disposition = 'attachment') { - return \Illuminate\Routing\ResponseFactory::download($file, $name, $headers, $disposition); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->download($file, $name, $headers, $disposition); } /** @@ -8296,7 +10287,8 @@ public static function download($file, $name = null, $headers = array(), $dispos */ public static function file($file, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::file($file, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->file($file, $headers); } /** @@ -8311,7 +10303,8 @@ public static function file($file, $headers = array()) */ public static function redirectTo($path, $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\ResponseFactory::redirectTo($path, $status, $headers, $secure); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->redirectTo($path, $status, $headers, $secure); } /** @@ -8326,7 +10319,8 @@ public static function redirectTo($path, $status = 302, $headers = array(), $sec */ public static function redirectToRoute($route, $parameters = array(), $status = 302, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::redirectToRoute($route, $parameters, $status, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->redirectToRoute($route, $parameters, $status, $headers); } /** @@ -8341,7 +10335,8 @@ public static function redirectToRoute($route, $parameters = array(), $status = */ public static function redirectToAction($action, $parameters = array(), $status = 302, $headers = array()) { - return \Illuminate\Routing\ResponseFactory::redirectToAction($action, $parameters, $status, $headers); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->redirectToAction($action, $parameters, $status, $headers); } /** @@ -8356,7 +10351,8 @@ public static function redirectToAction($action, $parameters = array(), $status */ public static function redirectGuest($path, $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\ResponseFactory::redirectGuest($path, $status, $headers, $secure); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->redirectGuest($path, $status, $headers, $secure); } /** @@ -8371,20 +10367,34 @@ public static function redirectGuest($path, $status = 302, $headers = array(), $ */ public static function redirectToIntended($default = '/', $status = 302, $headers = array(), $secure = null) { - return \Illuminate\Routing\ResponseFactory::redirectToIntended($default, $status, $headers, $secure); + /** @var \Illuminate\Routing\ResponseFactory $instance */ + return $instance->redirectToIntended($default, $status, $headers, $secure); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Routing\ResponseFactory::macro($name, $macro); + \Illuminate\Routing\ResponseFactory::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Routing\ResponseFactory::mixin($mixin); } /** @@ -8396,11 +10406,23 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Routing\ResponseFactory::hasMacro($name); + return \Illuminate\Routing\ResponseFactory::hasMacro($name); } } + /** + * + * + * @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix) + * @method static \Illuminate\Routing\RouteRegistrar where(array $where) + * @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware) + * @method static \Illuminate\Routing\RouteRegistrar as(string $value) + * @method static \Illuminate\Routing\RouteRegistrar domain(string $value) + * @method static \Illuminate\Routing\RouteRegistrar name(string $value) + * @method static \Illuminate\Routing\RouteRegistrar namespace(string $value) + * @see \Illuminate\Routing\Router + */ class Route { /** @@ -8413,7 +10435,8 @@ class Route { */ public static function get($uri, $action = null) { - return \Illuminate\Routing\Router::get($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->get($uri, $action); } /** @@ -8426,7 +10449,8 @@ public static function get($uri, $action = null) */ public static function post($uri, $action = null) { - return \Illuminate\Routing\Router::post($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->post($uri, $action); } /** @@ -8439,7 +10463,8 @@ public static function post($uri, $action = null) */ public static function put($uri, $action = null) { - return \Illuminate\Routing\Router::put($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->put($uri, $action); } /** @@ -8452,7 +10477,8 @@ public static function put($uri, $action = null) */ public static function patch($uri, $action = null) { - return \Illuminate\Routing\Router::patch($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->patch($uri, $action); } /** @@ -8465,7 +10491,8 @@ public static function patch($uri, $action = null) */ public static function delete($uri, $action = null) { - return \Illuminate\Routing\Router::delete($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->delete($uri, $action); } /** @@ -8478,7 +10505,8 @@ public static function delete($uri, $action = null) */ public static function options($uri, $action = null) { - return \Illuminate\Routing\Router::options($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->options($uri, $action); } /** @@ -8491,7 +10519,51 @@ public static function options($uri, $action = null) */ public static function any($uri, $action = null) { - return \Illuminate\Routing\Router::any($uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->any($uri, $action); + } + + /** + * Register a new Fallback route with the router. + * + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + * @static + */ + public static function fallback($action) + { + /** @var \Illuminate\Routing\Router $instance */ + return $instance->fallback($action); + } + + /** + * Create a redirect from one URI to another. + * + * @param string $uri + * @param string $destination + * @param int $status + * @return \Illuminate\Routing\Route + * @static + */ + public static function redirect($uri, $destination, $status = 301) + { + /** @var \Illuminate\Routing\Router $instance */ + return $instance->redirect($uri, $destination, $status); + } + + /** + * Register a new route that returns a view. + * + * @param string $uri + * @param string $view + * @param array $data + * @return \Illuminate\Routing\Route + * @static + */ + public static function view($uri, $view, $data = array()) + { + /** @var \Illuminate\Routing\Router $instance */ + return $instance->view($uri, $view, $data); } /** @@ -8505,7 +10577,8 @@ public static function any($uri, $action = null) */ public static function match($methods, $uri, $action = null) { - return \Illuminate\Routing\Router::match($methods, $uri, $action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->match($methods, $uri, $action); } /** @@ -8517,7 +10590,8 @@ public static function match($methods, $uri, $action = null) */ public static function resources($resources) { - \Illuminate\Routing\Router::resources($resources); + /** @var \Illuminate\Routing\Router $instance */ + $instance->resources($resources); } /** @@ -8526,26 +10600,41 @@ public static function resources($resources) * @param string $name * @param string $controller * @param array $options - * @return void + * @return \Illuminate\Routing\PendingResourceRegistration * @static */ public static function resource($name, $controller, $options = array()) { - \Illuminate\Routing\Router::resource($name, $controller, $options); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->resource($name, $controller, $options); + } + + /** + * Register an array of API resource controllers. + * + * @param array $resources + * @return void + * @static + */ + public static function apiResources($resources) + { + /** @var \Illuminate\Routing\Router $instance */ + $instance->apiResources($resources); } /** - * Route an api resource to a controller. + * Route an API resource to a controller. * * @param string $name * @param string $controller * @param array $options - * @return void + * @return \Illuminate\Routing\PendingResourceRegistration * @static */ public static function apiResource($name, $controller, $options = array()) { - \Illuminate\Routing\Router::apiResource($name, $controller, $options); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->apiResource($name, $controller, $options); } /** @@ -8558,7 +10647,8 @@ public static function apiResource($name, $controller, $options = array()) */ public static function group($attributes, $routes) { - \Illuminate\Routing\Router::group($attributes, $routes); + /** @var \Illuminate\Routing\Router $instance */ + $instance->group($attributes, $routes); } /** @@ -8570,7 +10660,8 @@ public static function group($attributes, $routes) */ public static function mergeWithLastGroup($new) { - return \Illuminate\Routing\Router::mergeWithLastGroup($new); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->mergeWithLastGroup($new); } /** @@ -8581,19 +10672,49 @@ public static function mergeWithLastGroup($new) */ public static function getLastGroupPrefix() { - return \Illuminate\Routing\Router::getLastGroupPrefix(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getLastGroupPrefix(); + } + + /** + * Add a route to the underlying route collection. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + * @static + */ + public static function addRoute($methods, $uri, $action) + { + /** @var \Illuminate\Routing\Router $instance */ + return $instance->addRoute($methods, $uri, $action); + } + + /** + * Return the response returned by the given route. + * + * @param string $name + * @return mixed + * @static + */ + public static function respondWithRoute($name) + { + /** @var \Illuminate\Routing\Router $instance */ + return $instance->respondWithRoute($name); } /** * Dispatch the request to the application. * * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse * @static */ public static function dispatch($request) { - return \Illuminate\Routing\Router::dispatch($request); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->dispatch($request); } /** @@ -8605,7 +10726,8 @@ public static function dispatch($request) */ public static function dispatchToRoute($request) { - return \Illuminate\Routing\Router::dispatchToRoute($request); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->dispatchToRoute($request); } /** @@ -8617,7 +10739,8 @@ public static function dispatchToRoute($request) */ public static function gatherRouteMiddleware($route) { - return \Illuminate\Routing\Router::gatherRouteMiddleware($route); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->gatherRouteMiddleware($route); } /** @@ -8625,12 +10748,26 @@ public static function gatherRouteMiddleware($route) * * @param \Symfony\Component\HttpFoundation\Request $request * @param mixed $response - * @return \Illuminate\Http\Response + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse * @static */ public static function prepareResponse($request, $response) { - return \Illuminate\Routing\Router::prepareResponse($request, $response); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->prepareResponse($request, $response); + } + + /** + * Static version of prepareResponse. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + * @static + */ + public static function toResponse($request, $response) + { + return \Illuminate\Routing\Router::toResponse($request, $response); } /** @@ -8642,7 +10779,8 @@ public static function prepareResponse($request, $response) */ public static function substituteBindings($route) { - return \Illuminate\Routing\Router::substituteBindings($route); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->substituteBindings($route); } /** @@ -8654,7 +10792,8 @@ public static function substituteBindings($route) */ public static function substituteImplicitBindings($route) { - \Illuminate\Routing\Router::substituteImplicitBindings($route); + /** @var \Illuminate\Routing\Router $instance */ + $instance->substituteImplicitBindings($route); } /** @@ -8666,7 +10805,8 @@ public static function substituteImplicitBindings($route) */ public static function matched($callback) { - \Illuminate\Routing\Router::matched($callback); + /** @var \Illuminate\Routing\Router $instance */ + $instance->matched($callback); } /** @@ -8677,7 +10817,8 @@ public static function matched($callback) */ public static function getMiddleware() { - return \Illuminate\Routing\Router::getMiddleware(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getMiddleware(); } /** @@ -8685,12 +10826,13 @@ public static function getMiddleware() * * @param string $name * @param string $class - * @return $this + * @return \Illuminate\Routing\Router * @static */ public static function aliasMiddleware($name, $class) { - return \Illuminate\Routing\Router::aliasMiddleware($name, $class); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->aliasMiddleware($name, $class); } /** @@ -8702,7 +10844,8 @@ public static function aliasMiddleware($name, $class) */ public static function hasMiddlewareGroup($name) { - return \Illuminate\Routing\Router::hasMiddlewareGroup($name); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->hasMiddlewareGroup($name); } /** @@ -8713,7 +10856,8 @@ public static function hasMiddlewareGroup($name) */ public static function getMiddlewareGroups() { - return \Illuminate\Routing\Router::getMiddlewareGroups(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getMiddlewareGroups(); } /** @@ -8721,12 +10865,13 @@ public static function getMiddlewareGroups() * * @param string $name * @param array $middleware - * @return $this + * @return \Illuminate\Routing\Router * @static */ public static function middlewareGroup($name, $middleware) { - return \Illuminate\Routing\Router::middlewareGroup($name, $middleware); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->middlewareGroup($name, $middleware); } /** @@ -8736,12 +10881,13 @@ public static function middlewareGroup($name, $middleware) * * @param string $group * @param string $middleware - * @return $this + * @return \Illuminate\Routing\Router * @static */ public static function prependMiddlewareToGroup($group, $middleware) { - return \Illuminate\Routing\Router::prependMiddlewareToGroup($group, $middleware); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->prependMiddlewareToGroup($group, $middleware); } /** @@ -8751,12 +10897,13 @@ public static function prependMiddlewareToGroup($group, $middleware) * * @param string $group * @param string $middleware - * @return $this + * @return \Illuminate\Routing\Router * @static */ public static function pushMiddlewareToGroup($group, $middleware) { - return \Illuminate\Routing\Router::pushMiddlewareToGroup($group, $middleware); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->pushMiddlewareToGroup($group, $middleware); } /** @@ -8769,7 +10916,8 @@ public static function pushMiddlewareToGroup($group, $middleware) */ public static function bind($key, $binder) { - \Illuminate\Routing\Router::bind($key, $binder); + /** @var \Illuminate\Routing\Router $instance */ + $instance->bind($key, $binder); } /** @@ -8784,7 +10932,8 @@ public static function bind($key, $binder) */ public static function model($key, $class, $callback = null) { - \Illuminate\Routing\Router::model($key, $class, $callback); + /** @var \Illuminate\Routing\Router $instance */ + $instance->model($key, $class, $callback); } /** @@ -8796,7 +10945,8 @@ public static function model($key, $class, $callback = null) */ public static function getBindingCallback($key) { - return \Illuminate\Routing\Router::getBindingCallback($key); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getBindingCallback($key); } /** @@ -8807,7 +10957,8 @@ public static function getBindingCallback($key) */ public static function getPatterns() { - return \Illuminate\Routing\Router::getPatterns(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getPatterns(); } /** @@ -8820,7 +10971,8 @@ public static function getPatterns() */ public static function pattern($key, $pattern) { - \Illuminate\Routing\Router::pattern($key, $pattern); + /** @var \Illuminate\Routing\Router $instance */ + $instance->pattern($key, $pattern); } /** @@ -8832,7 +10984,8 @@ public static function pattern($key, $pattern) */ public static function patterns($patterns) { - \Illuminate\Routing\Router::patterns($patterns); + /** @var \Illuminate\Routing\Router $instance */ + $instance->patterns($patterns); } /** @@ -8843,7 +10996,8 @@ public static function patterns($patterns) */ public static function hasGroupStack() { - return \Illuminate\Routing\Router::hasGroupStack(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->hasGroupStack(); } /** @@ -8854,7 +11008,8 @@ public static function hasGroupStack() */ public static function getGroupStack() { - return \Illuminate\Routing\Router::getGroupStack(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getGroupStack(); } /** @@ -8867,7 +11022,8 @@ public static function getGroupStack() */ public static function input($key, $default = null) { - return \Illuminate\Routing\Router::input($key, $default); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->input($key, $default); } /** @@ -8878,7 +11034,8 @@ public static function input($key, $default = null) */ public static function getCurrentRequest() { - return \Illuminate\Routing\Router::getCurrentRequest(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getCurrentRequest(); } /** @@ -8889,7 +11046,8 @@ public static function getCurrentRequest() */ public static function getCurrentRoute() { - return \Illuminate\Routing\Router::getCurrentRoute(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getCurrentRoute(); } /** @@ -8900,7 +11058,8 @@ public static function getCurrentRoute() */ public static function current() { - return \Illuminate\Routing\Router::current(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->current(); } /** @@ -8912,7 +11071,8 @@ public static function current() */ public static function has($name) { - return \Illuminate\Routing\Router::has($name); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->has($name); } /** @@ -8923,30 +11083,34 @@ public static function has($name) */ public static function currentRouteName() { - return \Illuminate\Routing\Router::currentRouteName(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->currentRouteName(); } /** * Alias for the "currentRouteNamed" method. * + * @param mixed $patterns * @return bool * @static */ - public static function is() + public static function is($patterns = null) { - return \Illuminate\Routing\Router::is(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->is($patterns); } /** - * Determine if the current route matches a given name. + * Determine if the current route matches a pattern. * - * @param string $name + * @param mixed $patterns * @return bool * @static */ - public static function currentRouteNamed($name) + public static function currentRouteNamed($patterns = null) { - return \Illuminate\Routing\Router::currentRouteNamed($name); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->currentRouteNamed($patterns); } /** @@ -8957,18 +11121,21 @@ public static function currentRouteNamed($name) */ public static function currentRouteAction() { - return \Illuminate\Routing\Router::currentRouteAction(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->currentRouteAction(); } /** * Alias for the "currentRouteUses" method. * + * @param array $patterns * @return bool * @static */ - public static function uses() + public static function uses($patterns = null) { - return \Illuminate\Routing\Router::uses(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->uses($patterns); } /** @@ -8980,7 +11147,8 @@ public static function uses() */ public static function currentRouteUses($action) { - return \Illuminate\Routing\Router::currentRouteUses($action); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->currentRouteUses($action); } /** @@ -8991,7 +11159,8 @@ public static function currentRouteUses($action) */ public static function auth() { - \Illuminate\Routing\Router::auth(); + /** @var \Illuminate\Routing\Router $instance */ + $instance->auth(); } /** @@ -9003,7 +11172,8 @@ public static function auth() */ public static function singularResourceParameters($singular = true) { - \Illuminate\Routing\Router::singularResourceParameters($singular); + /** @var \Illuminate\Routing\Router $instance */ + $instance->singularResourceParameters($singular); } /** @@ -9015,7 +11185,8 @@ public static function singularResourceParameters($singular = true) */ public static function resourceParameters($parameters = array()) { - \Illuminate\Routing\Router::resourceParameters($parameters); + /** @var \Illuminate\Routing\Router $instance */ + $instance->resourceParameters($parameters); } /** @@ -9027,7 +11198,8 @@ public static function resourceParameters($parameters = array()) */ public static function resourceVerbs($verbs = array()) { - return \Illuminate\Routing\Router::resourceVerbs($verbs); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->resourceVerbs($verbs); } /** @@ -9038,7 +11210,8 @@ public static function resourceVerbs($verbs = array()) */ public static function getRoutes() { - return \Illuminate\Routing\Router::getRoutes(); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->getRoutes(); } /** @@ -9050,20 +11223,34 @@ public static function getRoutes() */ public static function setRoutes($routes) { - \Illuminate\Routing\Router::setRoutes($routes); + /** @var \Illuminate\Routing\Router $instance */ + $instance->setRoutes($routes); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) { - \Illuminate\Routing\Router::macro($name, $macro); + \Illuminate\Routing\Router::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Routing\Router::mixin($mixin); } /** @@ -9075,7 +11262,7 @@ public static function macro($name, $macro) */ public static function hasMacro($name) { - return \Illuminate\Routing\Router::hasMacro($name); + return \Illuminate\Routing\Router::hasMacro($name); } /** @@ -9089,11 +11276,17 @@ public static function hasMacro($name) */ public static function macroCall($method, $parameters) { - return \Illuminate\Routing\Router::macroCall($method, $parameters); + /** @var \Illuminate\Routing\Router $instance */ + return $instance->macroCall($method, $parameters); } } + /** + * + * + * @see \Illuminate\Database\Schema\Builder + */ class Schema { /** @@ -9105,7 +11298,8 @@ class Schema { */ public static function hasTable($table) { - return \Illuminate\Database\Schema\MySqlBuilder::hasTable($table); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->hasTable($table); } /** @@ -9117,7 +11311,32 @@ public static function hasTable($table) */ public static function getColumnListing($table) { - return \Illuminate\Database\Schema\MySqlBuilder::getColumnListing($table); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->getColumnListing($table); + } + + /** + * Drop all tables from the database. + * + * @return void + * @static + */ + public static function dropAllTables() + { + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->dropAllTables(); + } + + /** + * Drop all views from the database. + * + * @return void + * @static + */ + public static function dropAllViews() + { + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->dropAllViews(); } /** @@ -9130,7 +11349,7 @@ public static function getColumnListing($table) public static function defaultStringLength($length) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::defaultStringLength($length); + \Illuminate\Database\Schema\MySqlBuilder::defaultStringLength($length); } /** @@ -9144,7 +11363,8 @@ public static function defaultStringLength($length) public static function hasColumn($table, $column) { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::hasColumn($table, $column); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->hasColumn($table, $column); } /** @@ -9158,7 +11378,8 @@ public static function hasColumn($table, $column) public static function hasColumns($table, $columns) { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::hasColumns($table, $columns); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->hasColumns($table, $columns); } /** @@ -9172,7 +11393,8 @@ public static function hasColumns($table, $columns) public static function getColumnType($table, $column) { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::getColumnType($table, $column); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->getColumnType($table, $column); } /** @@ -9186,7 +11408,8 @@ public static function getColumnType($table, $column) public static function table($table, $callback) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::table($table, $callback); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->table($table, $callback); } /** @@ -9200,7 +11423,8 @@ public static function table($table, $callback) public static function create($table, $callback) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::create($table, $callback); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->create($table, $callback); } /** @@ -9213,7 +11437,8 @@ public static function create($table, $callback) public static function drop($table) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::drop($table); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->drop($table); } /** @@ -9226,7 +11451,8 @@ public static function drop($table) public static function dropIfExists($table) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::dropIfExists($table); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->dropIfExists($table); } /** @@ -9240,7 +11466,8 @@ public static function dropIfExists($table) public static function rename($from, $to) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::rename($from, $to); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->rename($from, $to); } /** @@ -9252,7 +11479,8 @@ public static function rename($from, $to) public static function enableForeignKeyConstraints() { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::enableForeignKeyConstraints(); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->enableForeignKeyConstraints(); } /** @@ -9264,7 +11492,8 @@ public static function enableForeignKeyConstraints() public static function disableForeignKeyConstraints() { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::disableForeignKeyConstraints(); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->disableForeignKeyConstraints(); } /** @@ -9276,20 +11505,22 @@ public static function disableForeignKeyConstraints() public static function getConnection() { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::getConnection(); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->getConnection(); } /** * Set the database connection instance. * * @param \Illuminate\Database\Connection $connection - * @return $this + * @return \Illuminate\Database\Schema\MySqlBuilder * @static */ public static function setConnection($connection) { //Method inherited from \Illuminate\Database\Schema\Builder - return \Illuminate\Database\Schema\MySqlBuilder::setConnection($connection); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + return $instance->setConnection($connection); } /** @@ -9302,11 +11533,18 @@ public static function setConnection($connection) public static function blueprintResolver($resolver) { //Method inherited from \Illuminate\Database\Schema\Builder - \Illuminate\Database\Schema\MySqlBuilder::blueprintResolver($resolver); + /** @var \Illuminate\Database\Schema\MySqlBuilder $instance */ + $instance->blueprintResolver($resolver); } } + /** + * + * + * @see \Illuminate\Session\SessionManager + * @see \Illuminate\Session\Store + */ class Session { /** @@ -9317,7 +11555,8 @@ class Session { */ public static function getSessionConfig() { - return \Illuminate\Session\SessionManager::getSessionConfig(); + /** @var \Illuminate\Session\SessionManager $instance */ + return $instance->getSessionConfig(); } /** @@ -9328,7 +11567,8 @@ public static function getSessionConfig() */ public static function getDefaultDriver() { - return \Illuminate\Session\SessionManager::getDefaultDriver(); + /** @var \Illuminate\Session\SessionManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -9340,7 +11580,8 @@ public static function getDefaultDriver() */ public static function setDefaultDriver($name) { - \Illuminate\Session\SessionManager::setDefaultDriver($name); + /** @var \Illuminate\Session\SessionManager $instance */ + $instance->setDefaultDriver($name); } /** @@ -9348,12 +11589,14 @@ public static function setDefaultDriver($name) * * @param string $driver * @return mixed + * @throws \InvalidArgumentException * @static */ public static function driver($driver = null) { //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Session\SessionManager::driver($driver); + /** @var \Illuminate\Session\SessionManager $instance */ + return $instance->driver($driver); } /** @@ -9361,13 +11604,14 @@ public static function driver($driver = null) * * @param string $driver * @param \Closure $callback - * @return $this + * @return \Illuminate\Session\SessionManager * @static */ public static function extend($driver, $callback) { //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Session\SessionManager::extend($driver, $callback); + /** @var \Illuminate\Session\SessionManager $instance */ + return $instance->extend($driver, $callback); } /** @@ -9379,7 +11623,8 @@ public static function extend($driver, $callback) public static function getDrivers() { //Method inherited from \Illuminate\Support\Manager - return \Illuminate\Session\SessionManager::getDrivers(); + /** @var \Illuminate\Session\SessionManager $instance */ + return $instance->getDrivers(); } /** @@ -9390,7 +11635,8 @@ public static function getDrivers() */ public static function start() { - return \Illuminate\Session\Store::start(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->start(); } /** @@ -9401,7 +11647,8 @@ public static function start() */ public static function save() { - return \Illuminate\Session\Store::save(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->save(); } /** @@ -9412,7 +11659,8 @@ public static function save() */ public static function ageFlashData() { - \Illuminate\Session\Store::ageFlashData(); + /** @var \Illuminate\Session\Store $instance */ + $instance->ageFlashData(); } /** @@ -9423,7 +11671,8 @@ public static function ageFlashData() */ public static function all() { - return \Illuminate\Session\Store::all(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->all(); } /** @@ -9435,7 +11684,8 @@ public static function all() */ public static function exists($key) { - return \Illuminate\Session\Store::exists($key); + /** @var \Illuminate\Session\Store $instance */ + return $instance->exists($key); } /** @@ -9447,7 +11697,8 @@ public static function exists($key) */ public static function has($key) { - return \Illuminate\Session\Store::has($key); + /** @var \Illuminate\Session\Store $instance */ + return $instance->has($key); } /** @@ -9460,7 +11711,8 @@ public static function has($key) */ public static function get($key, $default = null) { - return \Illuminate\Session\Store::get($key, $default); + /** @var \Illuminate\Session\Store $instance */ + return $instance->get($key, $default); } /** @@ -9473,7 +11725,8 @@ public static function get($key, $default = null) */ public static function pull($key, $default = null) { - return \Illuminate\Session\Store::pull($key, $default); + /** @var \Illuminate\Session\Store $instance */ + return $instance->pull($key, $default); } /** @@ -9485,7 +11738,8 @@ public static function pull($key, $default = null) */ public static function hasOldInput($key = null) { - return \Illuminate\Session\Store::hasOldInput($key); + /** @var \Illuminate\Session\Store $instance */ + return $instance->hasOldInput($key); } /** @@ -9498,7 +11752,8 @@ public static function hasOldInput($key = null) */ public static function getOldInput($key = null, $default = null) { - return \Illuminate\Session\Store::getOldInput($key, $default); + /** @var \Illuminate\Session\Store $instance */ + return $instance->getOldInput($key, $default); } /** @@ -9510,7 +11765,8 @@ public static function getOldInput($key = null, $default = null) */ public static function replace($attributes) { - \Illuminate\Session\Store::replace($attributes); + /** @var \Illuminate\Session\Store $instance */ + $instance->replace($attributes); } /** @@ -9523,7 +11779,8 @@ public static function replace($attributes) */ public static function put($key, $value = null) { - \Illuminate\Session\Store::put($key, $value); + /** @var \Illuminate\Session\Store $instance */ + $instance->put($key, $value); } /** @@ -9536,7 +11793,8 @@ public static function put($key, $value = null) */ public static function remember($key, $callback) { - return \Illuminate\Session\Store::remember($key, $callback); + /** @var \Illuminate\Session\Store $instance */ + return $instance->remember($key, $callback); } /** @@ -9549,7 +11807,8 @@ public static function remember($key, $callback) */ public static function push($key, $value) { - \Illuminate\Session\Store::push($key, $value); + /** @var \Illuminate\Session\Store $instance */ + $instance->push($key, $value); } /** @@ -9562,7 +11821,8 @@ public static function push($key, $value) */ public static function increment($key, $amount = 1) { - return \Illuminate\Session\Store::increment($key, $amount); + /** @var \Illuminate\Session\Store $instance */ + return $instance->increment($key, $amount); } /** @@ -9575,7 +11835,8 @@ public static function increment($key, $amount = 1) */ public static function decrement($key, $amount = 1) { - return \Illuminate\Session\Store::decrement($key, $amount); + /** @var \Illuminate\Session\Store $instance */ + return $instance->decrement($key, $amount); } /** @@ -9586,9 +11847,10 @@ public static function decrement($key, $amount = 1) * @return void * @static */ - public static function flash($key, $value) + public static function flash($key, $value = true) { - \Illuminate\Session\Store::flash($key, $value); + /** @var \Illuminate\Session\Store $instance */ + $instance->flash($key, $value); } /** @@ -9601,7 +11863,8 @@ public static function flash($key, $value) */ public static function now($key, $value) { - \Illuminate\Session\Store::now($key, $value); + /** @var \Illuminate\Session\Store $instance */ + $instance->now($key, $value); } /** @@ -9612,7 +11875,8 @@ public static function now($key, $value) */ public static function reflash() { - \Illuminate\Session\Store::reflash(); + /** @var \Illuminate\Session\Store $instance */ + $instance->reflash(); } /** @@ -9624,7 +11888,8 @@ public static function reflash() */ public static function keep($keys = null) { - \Illuminate\Session\Store::keep($keys); + /** @var \Illuminate\Session\Store $instance */ + $instance->keep($keys); } /** @@ -9636,7 +11901,8 @@ public static function keep($keys = null) */ public static function flashInput($value) { - \Illuminate\Session\Store::flashInput($value); + /** @var \Illuminate\Session\Store $instance */ + $instance->flashInput($value); } /** @@ -9648,7 +11914,8 @@ public static function flashInput($value) */ public static function remove($key) { - return \Illuminate\Session\Store::remove($key); + /** @var \Illuminate\Session\Store $instance */ + return $instance->remove($key); } /** @@ -9660,7 +11927,8 @@ public static function remove($key) */ public static function forget($keys) { - \Illuminate\Session\Store::forget($keys); + /** @var \Illuminate\Session\Store $instance */ + $instance->forget($keys); } /** @@ -9671,7 +11939,8 @@ public static function forget($keys) */ public static function flush() { - \Illuminate\Session\Store::flush(); + /** @var \Illuminate\Session\Store $instance */ + $instance->flush(); } /** @@ -9682,7 +11951,8 @@ public static function flush() */ public static function invalidate() { - return \Illuminate\Session\Store::invalidate(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->invalidate(); } /** @@ -9694,7 +11964,8 @@ public static function invalidate() */ public static function regenerate($destroy = false) { - return \Illuminate\Session\Store::regenerate($destroy); + /** @var \Illuminate\Session\Store $instance */ + return $instance->regenerate($destroy); } /** @@ -9706,7 +11977,8 @@ public static function regenerate($destroy = false) */ public static function migrate($destroy = false) { - return \Illuminate\Session\Store::migrate($destroy); + /** @var \Illuminate\Session\Store $instance */ + return $instance->migrate($destroy); } /** @@ -9717,7 +11989,8 @@ public static function migrate($destroy = false) */ public static function isStarted() { - return \Illuminate\Session\Store::isStarted(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->isStarted(); } /** @@ -9728,7 +12001,8 @@ public static function isStarted() */ public static function getName() { - return \Illuminate\Session\Store::getName(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->getName(); } /** @@ -9740,7 +12014,8 @@ public static function getName() */ public static function setName($name) { - \Illuminate\Session\Store::setName($name); + /** @var \Illuminate\Session\Store $instance */ + $instance->setName($name); } /** @@ -9751,7 +12026,8 @@ public static function setName($name) */ public static function getId() { - return \Illuminate\Session\Store::getId(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->getId(); } /** @@ -9763,7 +12039,8 @@ public static function getId() */ public static function setId($id) { - \Illuminate\Session\Store::setId($id); + /** @var \Illuminate\Session\Store $instance */ + $instance->setId($id); } /** @@ -9775,7 +12052,8 @@ public static function setId($id) */ public static function isValidId($id) { - return \Illuminate\Session\Store::isValidId($id); + /** @var \Illuminate\Session\Store $instance */ + return $instance->isValidId($id); } /** @@ -9787,7 +12065,8 @@ public static function isValidId($id) */ public static function setExists($value) { - \Illuminate\Session\Store::setExists($value); + /** @var \Illuminate\Session\Store $instance */ + $instance->setExists($value); } /** @@ -9798,7 +12077,8 @@ public static function setExists($value) */ public static function token() { - return \Illuminate\Session\Store::token(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->token(); } /** @@ -9809,7 +12089,8 @@ public static function token() */ public static function regenerateToken() { - \Illuminate\Session\Store::regenerateToken(); + /** @var \Illuminate\Session\Store $instance */ + $instance->regenerateToken(); } /** @@ -9820,7 +12101,8 @@ public static function regenerateToken() */ public static function previousUrl() { - return \Illuminate\Session\Store::previousUrl(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->previousUrl(); } /** @@ -9832,7 +12114,8 @@ public static function previousUrl() */ public static function setPreviousUrl($url) { - \Illuminate\Session\Store::setPreviousUrl($url); + /** @var \Illuminate\Session\Store $instance */ + $instance->setPreviousUrl($url); } /** @@ -9843,7 +12126,8 @@ public static function setPreviousUrl($url) */ public static function getHandler() { - return \Illuminate\Session\Store::getHandler(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->getHandler(); } /** @@ -9854,7 +12138,8 @@ public static function getHandler() */ public static function handlerNeedsRequest() { - return \Illuminate\Session\Store::handlerNeedsRequest(); + /** @var \Illuminate\Session\Store $instance */ + return $instance->handlerNeedsRequest(); } /** @@ -9866,11 +12151,17 @@ public static function handlerNeedsRequest() */ public static function setRequestOnHandler($request) { - \Illuminate\Session\Store::setRequestOnHandler($request); + /** @var \Illuminate\Session\Store $instance */ + $instance->setRequestOnHandler($request); } } + /** + * + * + * @see \Illuminate\Filesystem\FilesystemManager + */ class Storage { /** @@ -9882,7 +12173,8 @@ class Storage { */ public static function drive($name = null) { - return \Illuminate\Filesystem\FilesystemManager::drive($name); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->drive($name); } /** @@ -9894,7 +12186,8 @@ public static function drive($name = null) */ public static function disk($name = null) { - return \Illuminate\Filesystem\FilesystemManager::disk($name); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->disk($name); } /** @@ -9905,7 +12198,8 @@ public static function disk($name = null) */ public static function cloud() { - return \Illuminate\Filesystem\FilesystemManager::cloud(); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->cloud(); } /** @@ -9917,7 +12211,8 @@ public static function cloud() */ public static function createLocalDriver($config) { - return \Illuminate\Filesystem\FilesystemManager::createLocalDriver($config); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->createLocalDriver($config); } /** @@ -9929,7 +12224,21 @@ public static function createLocalDriver($config) */ public static function createFtpDriver($config) { - return \Illuminate\Filesystem\FilesystemManager::createFtpDriver($config); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->createFtpDriver($config); + } + + /** + * Create an instance of the sftp driver. + * + * @param array $config + * @return \Illuminate\Filesystem\FilesystemAdapter + * @static + */ + public static function createSftpDriver($config) + { + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->createSftpDriver($config); } /** @@ -9941,7 +12250,8 @@ public static function createFtpDriver($config) */ public static function createS3Driver($config) { - return \Illuminate\Filesystem\FilesystemManager::createS3Driver($config); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->createS3Driver($config); } /** @@ -9953,7 +12263,8 @@ public static function createS3Driver($config) */ public static function createRackspaceDriver($config) { - return \Illuminate\Filesystem\FilesystemManager::createRackspaceDriver($config); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->createRackspaceDriver($config); } /** @@ -9961,12 +12272,13 @@ public static function createRackspaceDriver($config) * * @param string $name * @param mixed $disk - * @return void + * @return \Illuminate\Filesystem\FilesystemManager * @static */ public static function set($name, $disk) { - \Illuminate\Filesystem\FilesystemManager::set($name, $disk); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->set($name, $disk); } /** @@ -9977,7 +12289,8 @@ public static function set($name, $disk) */ public static function getDefaultDriver() { - return \Illuminate\Filesystem\FilesystemManager::getDefaultDriver(); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->getDefaultDriver(); } /** @@ -9988,7 +12301,21 @@ public static function getDefaultDriver() */ public static function getDefaultCloudDriver() { - return \Illuminate\Filesystem\FilesystemManager::getDefaultCloudDriver(); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->getDefaultCloudDriver(); + } + + /** + * Unset the given disk instances. + * + * @param array|string $disk + * @return \Illuminate\Filesystem\FilesystemManager + * @static + */ + public static function forgetDisk($disk) + { + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->forgetDisk($disk); } /** @@ -9996,12 +12323,13 @@ public static function getDefaultCloudDriver() * * @param string $driver * @param \Closure $callback - * @return $this + * @return \Illuminate\Filesystem\FilesystemManager * @static */ public static function extend($driver, $callback) { - return \Illuminate\Filesystem\FilesystemManager::extend($driver, $callback); + /** @var \Illuminate\Filesystem\FilesystemManager $instance */ + return $instance->extend($driver, $callback); } /** @@ -10013,7 +12341,8 @@ public static function extend($driver, $callback) */ public static function assertExists($path) { - \Illuminate\Filesystem\FilesystemAdapter::assertExists($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + $instance->assertExists($path); } /** @@ -10025,7 +12354,8 @@ public static function assertExists($path) */ public static function assertMissing($path) { - \Illuminate\Filesystem\FilesystemAdapter::assertMissing($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + $instance->assertMissing($path); } /** @@ -10037,7 +12367,21 @@ public static function assertMissing($path) */ public static function exists($path) { - return \Illuminate\Filesystem\FilesystemAdapter::exists($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->exists($path); + } + + /** + * Get the full path for the file at the given "short" path. + * + * @param string $path + * @return string + * @static + */ + public static function path($path) + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->path($path); } /** @@ -10050,7 +12394,39 @@ public static function exists($path) */ public static function get($path) { - return \Illuminate\Filesystem\FilesystemAdapter::get($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->get($path); + } + + /** + * Create a streamed response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + * @static + */ + public static function response($path, $name = null, $headers = array(), $disposition = 'inline') + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->response($path, $name, $headers, $disposition); + } + + /** + * Create a streamed download response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + * @static + */ + public static function download($path, $name = null, $headers = array()) + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->download($path, $name, $headers); } /** @@ -10058,13 +12434,14 @@ public static function get($path) * * @param string $path * @param string|resource $contents - * @param array $options + * @param mixed $options * @return bool * @static */ public static function put($path, $contents, $options = array()) { - return \Illuminate\Filesystem\FilesystemAdapter::put($path, $contents, $options); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->put($path, $contents, $options); } /** @@ -10078,7 +12455,8 @@ public static function put($path, $contents, $options = array()) */ public static function putFile($path, $file, $options = array()) { - return \Illuminate\Filesystem\FilesystemAdapter::putFile($path, $file, $options); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->putFile($path, $file, $options); } /** @@ -10093,7 +12471,8 @@ public static function putFile($path, $file, $options = array()) */ public static function putFileAs($path, $file, $name, $options = array()) { - return \Illuminate\Filesystem\FilesystemAdapter::putFileAs($path, $file, $name, $options); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->putFileAs($path, $file, $name, $options); } /** @@ -10105,7 +12484,8 @@ public static function putFileAs($path, $file, $name, $options = array()) */ public static function getVisibility($path) { - return \Illuminate\Filesystem\FilesystemAdapter::getVisibility($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->getVisibility($path); } /** @@ -10118,7 +12498,8 @@ public static function getVisibility($path) */ public static function setVisibility($path, $visibility) { - \Illuminate\Filesystem\FilesystemAdapter::setVisibility($path, $visibility); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + $instance->setVisibility($path, $visibility); } /** @@ -10132,7 +12513,8 @@ public static function setVisibility($path, $visibility) */ public static function prepend($path, $data, $separator = '') { - return \Illuminate\Filesystem\FilesystemAdapter::prepend($path, $data, $separator); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->prepend($path, $data, $separator); } /** @@ -10146,7 +12528,8 @@ public static function prepend($path, $data, $separator = '') */ public static function append($path, $data, $separator = '') { - return \Illuminate\Filesystem\FilesystemAdapter::append($path, $data, $separator); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->append($path, $data, $separator); } /** @@ -10158,7 +12541,8 @@ public static function append($path, $data, $separator = '') */ public static function delete($paths) { - return \Illuminate\Filesystem\FilesystemAdapter::delete($paths); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->delete($paths); } /** @@ -10171,7 +12555,8 @@ public static function delete($paths) */ public static function copy($from, $to) { - return \Illuminate\Filesystem\FilesystemAdapter::copy($from, $to); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->copy($from, $to); } /** @@ -10184,7 +12569,8 @@ public static function copy($from, $to) */ public static function move($from, $to) { - return \Illuminate\Filesystem\FilesystemAdapter::move($from, $to); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->move($from, $to); } /** @@ -10196,7 +12582,8 @@ public static function move($from, $to) */ public static function size($path) { - return \Illuminate\Filesystem\FilesystemAdapter::size($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->size($path); } /** @@ -10208,7 +12595,8 @@ public static function size($path) */ public static function mimeType($path) { - return \Illuminate\Filesystem\FilesystemAdapter::mimeType($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->mimeType($path); } /** @@ -10220,7 +12608,8 @@ public static function mimeType($path) */ public static function lastModified($path) { - return \Illuminate\Filesystem\FilesystemAdapter::lastModified($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->lastModified($path); } /** @@ -10232,24 +12621,73 @@ public static function lastModified($path) */ public static function url($path) { - return \Illuminate\Filesystem\FilesystemAdapter::url($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->url($path); } /** - * Get an array of all files in a directory. + * Get a temporary URL for the file at the given path. * - * @param string|null $directory - * @param bool $recursive - * @return array + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string * @static */ - public static function files($directory = null, $recursive = false) + public static function temporaryUrl($path, $expiration, $options = array()) { - return \Illuminate\Filesystem\FilesystemAdapter::files($directory, $recursive); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->temporaryUrl($path, $expiration, $options); } /** - * Get all of the files from the given directory (recursive). + * Get a temporary URL for the file at the given path. + * + * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + * @static + */ + public static function getAwsTemporaryUrl($adapter, $path, $expiration, $options) + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->getAwsTemporaryUrl($adapter, $path, $expiration, $options); + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + * @static + */ + public static function getRackspaceTemporaryUrl($adapter, $path, $expiration, $options) + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->getRackspaceTemporaryUrl($adapter, $path, $expiration, $options); + } + + /** + * Get an array of all files in a directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + * @static + */ + public static function files($directory = null, $recursive = false) + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->files($directory, $recursive); + } + + /** + * Get all of the files from the given directory (recursive). * * @param string|null $directory * @return array @@ -10257,7 +12695,8 @@ public static function files($directory = null, $recursive = false) */ public static function allFiles($directory = null) { - return \Illuminate\Filesystem\FilesystemAdapter::allFiles($directory); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->allFiles($directory); } /** @@ -10270,7 +12709,8 @@ public static function allFiles($directory = null) */ public static function directories($directory = null, $recursive = false) { - return \Illuminate\Filesystem\FilesystemAdapter::directories($directory, $recursive); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->directories($directory, $recursive); } /** @@ -10282,7 +12722,8 @@ public static function directories($directory = null, $recursive = false) */ public static function allDirectories($directory = null) { - return \Illuminate\Filesystem\FilesystemAdapter::allDirectories($directory); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->allDirectories($directory); } /** @@ -10294,7 +12735,8 @@ public static function allDirectories($directory = null) */ public static function makeDirectory($path) { - return \Illuminate\Filesystem\FilesystemAdapter::makeDirectory($path); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->makeDirectory($path); } /** @@ -10306,7 +12748,20 @@ public static function makeDirectory($path) */ public static function deleteDirectory($directory) { - return \Illuminate\Filesystem\FilesystemAdapter::deleteDirectory($directory); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->deleteDirectory($directory); + } + + /** + * Flush the Flysystem cache. + * + * @return void + * @static + */ + public static function flushCache() + { + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + $instance->flushCache(); } /** @@ -10317,11 +12772,17 @@ public static function deleteDirectory($directory) */ public static function getDriver() { - return \Illuminate\Filesystem\FilesystemAdapter::getDriver(); + /** @var \Illuminate\Filesystem\FilesystemAdapter $instance */ + return $instance->getDriver(); } } + /** + * + * + * @see \Illuminate\Routing\UrlGenerator + */ class URL { /** @@ -10332,7 +12793,8 @@ class URL { */ public static function full() { - return \Illuminate\Routing\UrlGenerator::full(); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->full(); } /** @@ -10343,7 +12805,8 @@ public static function full() */ public static function current() { - return \Illuminate\Routing\UrlGenerator::current(); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->current(); } /** @@ -10355,7 +12818,8 @@ public static function current() */ public static function previous($fallback = false) { - return \Illuminate\Routing\UrlGenerator::previous($fallback); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->previous($fallback); } /** @@ -10369,7 +12833,8 @@ public static function previous($fallback = false) */ public static function to($path, $extra = array(), $secure = null) { - return \Illuminate\Routing\UrlGenerator::to($path, $extra, $secure); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->to($path, $extra, $secure); } /** @@ -10382,7 +12847,8 @@ public static function to($path, $extra = array(), $secure = null) */ public static function secure($path, $parameters = array()) { - return \Illuminate\Routing\UrlGenerator::secure($path, $parameters); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->secure($path, $parameters); } /** @@ -10395,7 +12861,8 @@ public static function secure($path, $parameters = array()) */ public static function asset($path, $secure = null) { - return \Illuminate\Routing\UrlGenerator::asset($path, $secure); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->asset($path, $secure); } /** @@ -10407,7 +12874,8 @@ public static function asset($path, $secure = null) */ public static function secureAsset($path) { - return \Illuminate\Routing\UrlGenerator::secureAsset($path); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->secureAsset($path); } /** @@ -10421,7 +12889,8 @@ public static function secureAsset($path) */ public static function assetFrom($root, $path, $secure = null) { - return \Illuminate\Routing\UrlGenerator::assetFrom($root, $path, $secure); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->assetFrom($root, $path, $secure); } /** @@ -10433,7 +12902,51 @@ public static function assetFrom($root, $path, $secure = null) */ public static function formatScheme($secure) { - return \Illuminate\Routing\UrlGenerator::formatScheme($secure); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->formatScheme($secure); + } + + /** + * Create a signed route URL for a named route. + * + * @param string $name + * @param array $parameters + * @param \DateTimeInterface|int $expiration + * @return string + * @static + */ + public static function signedRoute($name, $parameters = array(), $expiration = null) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->signedRoute($name, $parameters, $expiration); + } + + /** + * Create a temporary signed route URL for a named route. + * + * @param string $name + * @param \DateTimeInterface|int $expiration + * @param array $parameters + * @return string + * @static + */ + public static function temporarySignedRoute($name, $expiration, $parameters = array()) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->temporarySignedRoute($name, $expiration, $parameters); + } + + /** + * Determine if the given request has a valid signature. + * + * @param \Illuminate\Http\Request $request + * @return bool + * @static + */ + public static function hasValidSignature($request) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->hasValidSignature($request); } /** @@ -10448,7 +12961,8 @@ public static function formatScheme($secure) */ public static function route($name, $parameters = array(), $absolute = true) { - return \Illuminate\Routing\UrlGenerator::route($name, $parameters, $absolute); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->route($name, $parameters, $absolute); } /** @@ -10463,7 +12977,8 @@ public static function route($name, $parameters = array(), $absolute = true) */ public static function action($action, $parameters = array(), $absolute = true) { - return \Illuminate\Routing\UrlGenerator::action($action, $parameters, $absolute); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->action($action, $parameters, $absolute); } /** @@ -10475,7 +12990,8 @@ public static function action($action, $parameters = array(), $absolute = true) */ public static function formatParameters($parameters) { - return \Illuminate\Routing\UrlGenerator::formatParameters($parameters); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->formatParameters($parameters); } /** @@ -10488,7 +13004,8 @@ public static function formatParameters($parameters) */ public static function formatRoot($scheme, $root = null) { - return \Illuminate\Routing\UrlGenerator::formatRoot($scheme, $root); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->formatRoot($scheme, $root); } /** @@ -10501,7 +13018,8 @@ public static function formatRoot($scheme, $root = null) */ public static function format($root, $path) { - return \Illuminate\Routing\UrlGenerator::format($root, $path); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->format($root, $path); } /** @@ -10513,7 +13031,8 @@ public static function format($root, $path) */ public static function isValidUrl($path) { - return \Illuminate\Routing\UrlGenerator::isValidUrl($path); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->isValidUrl($path); } /** @@ -10525,7 +13044,20 @@ public static function isValidUrl($path) */ public static function defaults($defaults) { - \Illuminate\Routing\UrlGenerator::defaults($defaults); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + $instance->defaults($defaults); + } + + /** + * Get the default named parameters used by the URL generator. + * + * @return array + * @static + */ + public static function getDefaultParameters() + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->getDefaultParameters(); } /** @@ -10537,7 +13069,8 @@ public static function defaults($defaults) */ public static function forceScheme($schema) { - \Illuminate\Routing\UrlGenerator::forceScheme($schema); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + $instance->forceScheme($schema); } /** @@ -10549,1005 +13082,2144 @@ public static function forceScheme($schema) */ public static function forceRootUrl($root) { - \Illuminate\Routing\UrlGenerator::forceRootUrl($root); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + $instance->forceRootUrl($root); } /** * Set a callback to be used to format the host of generated URLs. * * @param \Closure $callback - * @return $this + * @return \Illuminate\Routing\UrlGenerator * @static */ public static function formatHostUsing($callback) { - return \Illuminate\Routing\UrlGenerator::formatHostUsing($callback); + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->formatHostUsing($callback); + } + + /** + * Set a callback to be used to format the path of generated URLs. + * + * @param \Closure $callback + * @return \Illuminate\Routing\UrlGenerator + * @static + */ + public static function formatPathUsing($callback) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->formatPathUsing($callback); + } + + /** + * Get the path formatter being used by the URL generator. + * + * @return \Closure + * @static + */ + public static function pathFormatter() + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->pathFormatter(); + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request + * @static + */ + public static function getRequest() + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->getRequest(); + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + * @static + */ + public static function setRequest($request) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + $instance->setRequest($request); + } + + /** + * Set the route collection. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return \Illuminate\Routing\UrlGenerator + * @static + */ + public static function setRoutes($routes) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->setRoutes($routes); + } + + /** + * Set the session resolver for the generator. + * + * @param callable $sessionResolver + * @return \Illuminate\Routing\UrlGenerator + * @static + */ + public static function setSessionResolver($sessionResolver) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->setSessionResolver($sessionResolver); + } + + /** + * Set the encryption key resolver. + * + * @param callable $keyResolver + * @return \Illuminate\Routing\UrlGenerator + * @static + */ + public static function setKeyResolver($keyResolver) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->setKeyResolver($keyResolver); + } + + /** + * Set the root controller namespace. + * + * @param string $rootNamespace + * @return \Illuminate\Routing\UrlGenerator + * @static + */ + public static function setRootControllerNamespace($rootNamespace) + { + /** @var \Illuminate\Routing\UrlGenerator $instance */ + return $instance->setRootControllerNamespace($rootNamespace); + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * @return void + * @static + */ + public static function macro($name, $macro) + { + \Illuminate\Routing\UrlGenerator::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Routing\UrlGenerator::mixin($mixin); + } + + /** + * Checks if macro is registered. + * + * @param string $name + * @return bool + * @static + */ + public static function hasMacro($name) + { + return \Illuminate\Routing\UrlGenerator::hasMacro($name); + } + + } + + /** + * + * + * @see \Illuminate\Validation\Factory + */ + class Validator { + + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + * @static + */ + public static function make($data, $rules, $messages = array(), $customAttributes = array()) + { + /** @var \Illuminate\Validation\Factory $instance */ + return $instance->make($data, $rules, $messages, $customAttributes); + } + + /** + * Validate the given data against the provided rules. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * @throws \Illuminate\Validation\ValidationException + * @static + */ + public static function validate($data, $rules, $messages = array(), $customAttributes = array()) + { + /** @var \Illuminate\Validation\Factory $instance */ + return $instance->validate($data, $rules, $messages, $customAttributes); + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + * @static + */ + public static function extend($rule, $extension, $message = null) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->extend($rule, $extension, $message); + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + * @static + */ + public static function extendImplicit($rule, $extension, $message = null) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->extendImplicit($rule, $extension, $message); + } + + /** + * Register a custom dependent validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + * @static + */ + public static function extendDependent($rule, $extension, $message = null) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->extendDependent($rule, $extension, $message); + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + * @static + */ + public static function replacer($rule, $replacer) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->replacer($rule, $replacer); + } + + /** + * Set the Validator instance resolver. + * + * @param \Closure $resolver + * @return void + * @static + */ + public static function resolver($resolver) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->resolver($resolver); + } + + /** + * Get the Translator implementation. + * + * @return \Illuminate\Contracts\Translation\Translator + * @static + */ + public static function getTranslator() + { + /** @var \Illuminate\Validation\Factory $instance */ + return $instance->getTranslator(); + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + * @static + */ + public static function getPresenceVerifier() + { + /** @var \Illuminate\Validation\Factory $instance */ + return $instance->getPresenceVerifier(); + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + * @static + */ + public static function setPresenceVerifier($presenceVerifier) + { + /** @var \Illuminate\Validation\Factory $instance */ + $instance->setPresenceVerifier($presenceVerifier); + } + + } + + /** + * + * + * @see \Illuminate\View\Factory + */ + class View { + + /** + * Get the evaluated view contents for the given view. + * + * @param string $path + * @param array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + * @static + */ + public static function file($path, $data = array(), $mergeData = array()) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->file($path, $data, $mergeData); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + * @static + */ + public static function make($view, $data = array(), $mergeData = array()) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->make($view, $data, $mergeData); + } + + /** + * Get the first view that actually exists from the given list. + * + * @param array $views + * @param array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + * @throws \InvalidArgumentException + * @static + */ + public static function first($views, $data = array(), $mergeData = array()) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->first($views, $data, $mergeData); + } + + /** + * Get the rendered content of the view based on a given condition. + * + * @param bool $condition + * @param string $view + * @param array $data + * @param array $mergeData + * @return string + * @static + */ + public static function renderWhen($condition, $view, $data = array(), $mergeData = array()) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->renderWhen($condition, $view, $data, $mergeData); + } + + /** + * Get the rendered contents of a partial from a loop. + * + * @param string $view + * @param array $data + * @param string $iterator + * @param string $empty + * @return string + * @static + */ + public static function renderEach($view, $data, $iterator, $empty = 'raw|') + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->renderEach($view, $data, $iterator, $empty); + } + + /** + * Determine if a given view exists. + * + * @param string $view + * @return bool + * @static + */ + public static function exists($view) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->exists($view); + } + + /** + * Get the appropriate view engine for the given path. + * + * @param string $path + * @return \Illuminate\Contracts\View\Engine + * @throws \InvalidArgumentException + * @static + */ + public static function getEngineFromPath($path) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getEngineFromPath($path); + } + + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key + * @param mixed $value + * @return mixed + * @static + */ + public static function share($key, $value = null) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->share($key, $value); + } + + /** + * Increment the rendering counter. + * + * @return void + * @static + */ + public static function incrementRender() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->incrementRender(); + } + + /** + * Decrement the rendering counter. + * + * @return void + * @static + */ + public static function decrementRender() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->decrementRender(); + } + + /** + * Check if there are no active render operations. + * + * @return bool + * @static + */ + public static function doneRendering() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->doneRendering(); + } + + /** + * Add a location to the array of view locations. + * + * @param string $location + * @return void + * @static + */ + public static function addLocation($location) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->addLocation($location); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return \Illuminate\View\Factory + * @static + */ + public static function addNamespace($namespace, $hints) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->addNamespace($namespace, $hints); + } + + /** + * Prepend a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return \Illuminate\View\Factory + * @static + */ + public static function prependNamespace($namespace, $hints) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->prependNamespace($namespace, $hints); + } + + /** + * Replace the namespace hints for the given namespace. + * + * @param string $namespace + * @param string|array $hints + * @return \Illuminate\View\Factory + * @static + */ + public static function replaceNamespace($namespace, $hints) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->replaceNamespace($namespace, $hints); + } + + /** + * Register a valid view extension and its engine. + * + * @param string $extension + * @param string $engine + * @param \Closure $resolver + * @return void + * @static + */ + public static function addExtension($extension, $engine, $resolver = null) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->addExtension($extension, $engine, $resolver); + } + + /** + * Flush all of the factory state like sections and stacks. + * + * @return void + * @static + */ + public static function flushState() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->flushState(); + } + + /** + * Flush all of the section contents if done rendering. + * + * @return void + * @static + */ + public static function flushStateIfDoneRendering() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->flushStateIfDoneRendering(); + } + + /** + * Get the extension to engine bindings. + * + * @return array + * @static + */ + public static function getExtensions() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getExtensions(); + } + + /** + * Get the engine resolver instance. + * + * @return \Illuminate\View\Engines\EngineResolver + * @static + */ + public static function getEngineResolver() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getEngineResolver(); + } + + /** + * Get the view finder instance. + * + * @return \Illuminate\View\ViewFinderInterface + * @static + */ + public static function getFinder() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getFinder(); + } + + /** + * Set the view finder instance. + * + * @param \Illuminate\View\ViewFinderInterface $finder + * @return void + * @static + */ + public static function setFinder($finder) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->setFinder($finder); + } + + /** + * Flush the cache of views located by the finder. + * + * @return void + * @static + */ + public static function flushFinderCache() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->flushFinderCache(); + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + * @static + */ + public static function getDispatcher() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getDispatcher(); + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + * @static + */ + public static function setDispatcher($events) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->setDispatcher($events); + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + * @static + */ + public static function getContainer() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getContainer(); + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + * @static + */ + public static function setContainer($container) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->setContainer($container); + } + + /** + * Get an item from the shared data. + * + * @param string $key + * @param mixed $default + * @return mixed + * @static + */ + public static function shared($key, $default = null) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->shared($key, $default); + } + + /** + * Get all of the shared data for the environment. + * + * @return array + * @static + */ + public static function getShared() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getShared(); + } + + /** + * Start a component rendering process. + * + * @param string $name + * @param array $data + * @return void + * @static + */ + public static function startComponent($name, $data = array()) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->startComponent($name, $data); + } + + /** + * Render the current component. + * + * @return string + * @static + */ + public static function renderComponent() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->renderComponent(); + } + + /** + * Start the slot rendering process. + * + * @param string $name + * @param string|null $content + * @return void + * @static + */ + public static function slot($name, $content = null) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->slot($name, $content); + } + + /** + * Save the slot content for rendering. + * + * @return void + * @static + */ + public static function endSlot() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->endSlot(); + } + + /** + * Register a view creator event. + * + * @param array|string $views + * @param \Closure|string $callback + * @return array + * @static + */ + public static function creator($views, $callback) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->creator($views, $callback); + } + + /** + * Register multiple view composers via an array. + * + * @param array $composers + * @return array + * @static + */ + public static function composers($composers) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->composers($composers); + } + + /** + * Register a view composer event. + * + * @param array|string $views + * @param \Closure|string $callback + * @return array + * @static + */ + public static function composer($views, $callback) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->composer($views, $callback); + } + + /** + * Call the composer for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + * @static + */ + public static function callComposer($view) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->callComposer($view); + } + + /** + * Call the creator for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + * @static + */ + public static function callCreator($view) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->callCreator($view); + } + + /** + * Start injecting content into a section. + * + * @param string $section + * @param string|null $content + * @return void + * @static + */ + public static function startSection($section, $content = null) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->startSection($section, $content); + } + + /** + * Inject inline content into a section. + * + * @param string $section + * @param string $content + * @return void + * @static + */ + public static function inject($section, $content) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->inject($section, $content); + } + + /** + * Stop injecting content into a section and return its contents. + * + * @return string + * @static + */ + public static function yieldSection() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->yieldSection(); + } + + /** + * Stop injecting content into a section. + * + * @param bool $overwrite + * @return string + * @throws \InvalidArgumentException + * @static + */ + public static function stopSection($overwrite = false) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->stopSection($overwrite); + } + + /** + * Stop injecting content into a section and append it. + * + * @return string + * @throws \InvalidArgumentException + * @static + */ + public static function appendSection() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->appendSection(); + } + + /** + * Get the string contents of a section. + * + * @param string $section + * @param string $default + * @return string + * @static + */ + public static function yieldContent($section, $default = '') + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->yieldContent($section, $default); + } + + /** + * Get the parent placeholder for the current request. + * + * @param string $section + * @return string + * @static + */ + public static function parentPlaceholder($section = '') + { + return \Illuminate\View\Factory::parentPlaceholder($section); + } + + /** + * Check if section exists. + * + * @param string $name + * @return bool + * @static + */ + public static function hasSection($name) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->hasSection($name); + } + + /** + * Get the contents of a section. + * + * @param string $name + * @param string $default + * @return mixed + * @static + */ + public static function getSection($name, $default = null) + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getSection($name, $default); + } + + /** + * Get the entire array of sections. + * + * @return array + * @static + */ + public static function getSections() + { + /** @var \Illuminate\View\Factory $instance */ + return $instance->getSections(); + } + + /** + * Flush all of the sections. + * + * @return void + * @static + */ + public static function flushSections() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->flushSections(); + } + + /** + * Add new loop to the stack. + * + * @param \Countable|array $data + * @return void + * @static + */ + public static function addLoop($data) + { + /** @var \Illuminate\View\Factory $instance */ + $instance->addLoop($data); + } + + /** + * Increment the top loop's indices. + * + * @return void + * @static + */ + public static function incrementLoopIndices() + { + /** @var \Illuminate\View\Factory $instance */ + $instance->incrementLoopIndices(); } /** - * Set a callback to be used to format the path of generated URLs. + * Pop a loop from the top of the loop stack. * - * @param \Closure $callback - * @return $this + * @return void * @static */ - public static function formatPathUsing($callback) + public static function popLoop() { - return \Illuminate\Routing\UrlGenerator::formatPathUsing($callback); + /** @var \Illuminate\View\Factory $instance */ + $instance->popLoop(); } /** - * Get the path formatter being used by the URL generator. + * Get an instance of the last loop in the stack. * - * @return \Closure + * @return \stdClass|null * @static */ - public static function pathFormatter() + public static function getLastLoop() { - return \Illuminate\Routing\UrlGenerator::pathFormatter(); + /** @var \Illuminate\View\Factory $instance */ + return $instance->getLastLoop(); } /** - * Get the request instance. + * Get the entire loop stack. * - * @return \Illuminate\Http\Request + * @return array * @static */ - public static function getRequest() + public static function getLoopStack() { - return \Illuminate\Routing\UrlGenerator::getRequest(); + /** @var \Illuminate\View\Factory $instance */ + return $instance->getLoopStack(); } /** - * Set the current request instance. + * Start injecting content into a push section. * - * @param \Illuminate\Http\Request $request + * @param string $section + * @param string $content * @return void * @static */ - public static function setRequest($request) + public static function startPush($section, $content = '') { - \Illuminate\Routing\UrlGenerator::setRequest($request); + /** @var \Illuminate\View\Factory $instance */ + $instance->startPush($section, $content); } /** - * Set the route collection. + * Stop injecting content into a push section. * - * @param \Illuminate\Routing\RouteCollection $routes - * @return $this + * @return string + * @throws \InvalidArgumentException * @static */ - public static function setRoutes($routes) + public static function stopPush() { - return \Illuminate\Routing\UrlGenerator::setRoutes($routes); + /** @var \Illuminate\View\Factory $instance */ + return $instance->stopPush(); } /** - * Set the session resolver for the generator. + * Start prepending content into a push section. * - * @param callable $sessionResolver - * @return $this + * @param string $section + * @param string $content + * @return void * @static */ - public static function setSessionResolver($sessionResolver) + public static function startPrepend($section, $content = '') { - return \Illuminate\Routing\UrlGenerator::setSessionResolver($sessionResolver); + /** @var \Illuminate\View\Factory $instance */ + $instance->startPrepend($section, $content); } /** - * Set the root controller namespace. + * Stop prepending content into a push section. * - * @param string $rootNamespace - * @return $this + * @return string + * @throws \InvalidArgumentException * @static */ - public static function setRootControllerNamespace($rootNamespace) + public static function stopPrepend() { - return \Illuminate\Routing\UrlGenerator::setRootControllerNamespace($rootNamespace); + /** @var \Illuminate\View\Factory $instance */ + return $instance->stopPrepend(); } /** - * Register a custom macro. + * Get the string contents of a push section. * - * @param string $name - * @param callable $macro - * @return void + * @param string $section + * @param string $default + * @return string * @static */ - public static function macro($name, $macro) + public static function yieldPushContent($section, $default = '') { - \Illuminate\Routing\UrlGenerator::macro($name, $macro); + /** @var \Illuminate\View\Factory $instance */ + return $instance->yieldPushContent($section, $default); } /** - * Checks if macro is registered. + * Flush all of the stacks. * - * @param string $name - * @return bool + * @return void * @static */ - public static function hasMacro($name) + public static function flushStacks() { - return \Illuminate\Routing\UrlGenerator::hasMacro($name); + /** @var \Illuminate\View\Factory $instance */ + $instance->flushStacks(); } - - } - - class Validator { /** - * Create a new Validator instance. + * Start a translation block. * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * @return \Illuminate\Validation\Validator + * @param array $replacements + * @return void * @static */ - public static function make($data, $rules, $messages = array(), $customAttributes = array()) + public static function startTranslation($replacements = array()) { - return \Illuminate\Validation\Factory::make($data, $rules, $messages, $customAttributes); + /** @var \Illuminate\View\Factory $instance */ + $instance->startTranslation($replacements); } /** - * Validate the given data against the provided rules. + * Render the current translation. * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * @return void - * @throws \Illuminate\Validation\ValidationException + * @return string * @static */ - public static function validate($data, $rules, $messages = array(), $customAttributes = array()) + public static function renderTranslation() { - \Illuminate\Validation\Factory::validate($data, $rules, $messages, $customAttributes); + /** @var \Illuminate\View\Factory $instance */ + return $instance->renderTranslation(); } + + } + +} + +namespace Mews\Captcha\Facades { + + /** + * + * + * @see \Mews\Captcha + */ + class Captcha { /** - * Register a custom validator extension. + * Create captcha image * - * @param string $rule - * @param \Closure|string $extension - * @param string $message - * @return void + * @param string $config + * @param boolean $api + * @return \Mews\Captcha\ImageManager->response * @static */ - public static function extend($rule, $extension, $message = null) + public static function create($config = 'default', $api = false) { - \Illuminate\Validation\Factory::extend($rule, $extension, $message); + /** @var \Mews\Captcha\Captcha $instance */ + return $instance->create($config, $api); } /** - * Register a custom implicit validator extension. + * Captcha check * - * @param string $rule - * @param \Closure|string $extension - * @param string $message - * @return void + * @param $value + * @return bool * @static */ - public static function extendImplicit($rule, $extension, $message = null) + public static function check($value) { - \Illuminate\Validation\Factory::extendImplicit($rule, $extension, $message); + /** @var \Mews\Captcha\Captcha $instance */ + return $instance->check($value); } /** - * Register a custom dependent validator extension. + * Captcha check * - * @param string $rule - * @param \Closure|string $extension - * @param string $message - * @return void + * @param $value + * @return bool * @static */ - public static function extendDependent($rule, $extension, $message = null) + public static function check_api($value, $key) { - \Illuminate\Validation\Factory::extendDependent($rule, $extension, $message); + /** @var \Mews\Captcha\Captcha $instance */ + return $instance->check_api($value, $key); } /** - * Register a custom validator message replacer. + * Generate captcha image source * - * @param string $rule - * @param \Closure|string $replacer - * @return void + * @param null $config + * @return string * @static */ - public static function replacer($rule, $replacer) + public static function src($config = null) { - \Illuminate\Validation\Factory::replacer($rule, $replacer); + /** @var \Mews\Captcha\Captcha $instance */ + return $instance->src($config); } /** - * Set the Validator instance resolver. + * Generate captcha image html tag * - * @param \Closure $resolver - * @return void + * @param null $config + * @param array $attrs HTML attributes supplied to the image tag where key is the attribute + * and the value is the attribute value + * @return string * @static */ - public static function resolver($resolver) + public static function img($config = null, $attrs = array()) { - \Illuminate\Validation\Factory::resolver($resolver); + /** @var \Mews\Captcha\Captcha $instance */ + return $instance->img($config, $attrs); } + + } + +} + +namespace Jenssegers\Agent\Facades { + + /** + * + * + */ + class Agent { /** - * Get the Translator implementation. + * Get all detection rules. These rules include the additional + * platforms and browsers and utilities. * - * @return \Illuminate\Contracts\Translation\Translator + * @return array * @static */ - public static function getTranslator() + public static function getDetectionRulesExtended() { - return \Illuminate\Validation\Factory::getTranslator(); + return \Jenssegers\Agent\Agent::getDetectionRulesExtended(); } /** - * Get the Presence Verifier implementation. + * * - * @return \Illuminate\Validation\PresenceVerifierInterface * @static */ - public static function getPresenceVerifier() + public static function getRules() { - return \Illuminate\Validation\Factory::getPresenceVerifier(); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getRules(); } /** - * Set the Presence Verifier implementation. + * * - * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier - * @return void + * @return \Jenssegers\Agent\CrawlerDetect * @static */ - public static function setPresenceVerifier($presenceVerifier) + public static function getCrawlerDetect() { - \Illuminate\Validation\Factory::setPresenceVerifier($presenceVerifier); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getCrawlerDetect(); } - - } - - class View { /** - * Get the evaluated view contents for the given view. + * * - * @param string $path - * @param array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View * @static */ - public static function file($path, $data = array(), $mergeData = array()) + public static function getBrowsers() { - return \Illuminate\View\Factory::file($path, $data, $mergeData); + return \Jenssegers\Agent\Agent::getBrowsers(); } /** - * Get the evaluated view contents for the given view. + * * - * @param string $view - * @param array $data - * @param array $mergeData - * @return \Illuminate\Contracts\View\View * @static */ - public static function make($view, $data = array(), $mergeData = array()) + public static function getOperatingSystems() { - return \Illuminate\View\Factory::make($view, $data, $mergeData); + return \Jenssegers\Agent\Agent::getOperatingSystems(); } /** - * Get the rendered content of the view based on a given condition. + * * - * @param bool $condition - * @param string $view - * @param array $data - * @param array $mergeData - * @return string * @static */ - public static function renderWhen($condition, $view, $data = array(), $mergeData = array()) + public static function getPlatforms() { - return \Illuminate\View\Factory::renderWhen($condition, $view, $data, $mergeData); + return \Jenssegers\Agent\Agent::getPlatforms(); } /** - * Get the rendered contents of a partial from a loop. + * * - * @param string $view - * @param array $data - * @param string $iterator - * @param string $empty - * @return string * @static */ - public static function renderEach($view, $data, $iterator, $empty = 'raw|') + public static function getDesktopDevices() { - return \Illuminate\View\Factory::renderEach($view, $data, $iterator, $empty); + return \Jenssegers\Agent\Agent::getDesktopDevices(); } /** - * Determine if a given view exists. + * * - * @param string $view - * @return bool * @static */ - public static function exists($view) + public static function getProperties() { - return \Illuminate\View\Factory::exists($view); + return \Jenssegers\Agent\Agent::getProperties(); } /** - * Get the appropriate view engine for the given path. + * Get accept languages. * - * @param string $path - * @return \Illuminate\View\Engines\EngineInterface - * @throws \InvalidArgumentException + * @param string $acceptLanguage + * @return array * @static */ - public static function getEngineFromPath($path) + public static function languages($acceptLanguage = null) { - return \Illuminate\View\Factory::getEngineFromPath($path); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->languages($acceptLanguage); } /** - * Add a piece of shared data to the environment. + * Get the browser name. * - * @param array|string $key - * @param mixed $value - * @return mixed + * @param string|null $userAgent + * @return string * @static */ - public static function share($key, $value = null) + public static function browser($userAgent = null) { - return \Illuminate\View\Factory::share($key, $value); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->browser($userAgent); } /** - * Increment the rendering counter. + * Get the platform name. * - * @return void + * @param string|null $userAgent + * @return string * @static */ - public static function incrementRender() + public static function platform($userAgent = null) { - \Illuminate\View\Factory::incrementRender(); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->platform($userAgent); } /** - * Decrement the rendering counter. + * Get the device name. * - * @return void + * @param string|null $userAgent + * @return string * @static */ - public static function decrementRender() + public static function device($userAgent = null) { - \Illuminate\View\Factory::decrementRender(); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->device($userAgent); } /** - * Check if there are no active render operations. + * Check if the device is a desktop computer. * + * @param string|null $userAgent deprecated + * @param array $httpHeaders deprecated * @return bool * @static */ - public static function doneRendering() + public static function isDesktop($userAgent = null, $httpHeaders = null) { - return \Illuminate\View\Factory::doneRendering(); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->isDesktop($userAgent, $httpHeaders); } /** - * Add a location to the array of view locations. + * Check if the device is a mobile phone. * - * @param string $location - * @return void + * @param string|null $userAgent deprecated + * @param array $httpHeaders deprecated + * @return bool * @static */ - public static function addLocation($location) + public static function isPhone($userAgent = null, $httpHeaders = null) { - \Illuminate\View\Factory::addLocation($location); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->isPhone($userAgent, $httpHeaders); } /** - * Add a new namespace to the loader. + * Get the robot name. * - * @param string $namespace - * @param string|array $hints - * @return $this + * @param string|null $userAgent + * @return string|bool * @static */ - public static function addNamespace($namespace, $hints) + public static function robot($userAgent = null) { - return \Illuminate\View\Factory::addNamespace($namespace, $hints); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->robot($userAgent); } /** - * Prepend a new namespace to the loader. + * Check if device is a robot. * - * @param string $namespace - * @param string|array $hints - * @return $this + * @param string|null $userAgent + * @return bool * @static */ - public static function prependNamespace($namespace, $hints) + public static function isRobot($userAgent = null) { - return \Illuminate\View\Factory::prependNamespace($namespace, $hints); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->isRobot($userAgent); } /** - * Replace the namespace hints for the given namespace. + * * - * @param string $namespace - * @param string|array $hints - * @return $this * @static */ - public static function replaceNamespace($namespace, $hints) + public static function version($propertyName, $type = 'text') { - return \Illuminate\View\Factory::replaceNamespace($namespace, $hints); + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->version($propertyName, $type); } /** - * Register a valid view extension and its engine. + * Get the current script version. + * + * This is useful for the demo.php file, + * so people can check on what version they are testing + * for mobile devices. * - * @param string $extension - * @param string $engine - * @param \Closure $resolver - * @return void + * @return string The version number in semantic version format. * @static */ - public static function addExtension($extension, $engine, $resolver = null) + public static function getScriptVersion() { - \Illuminate\View\Factory::addExtension($extension, $engine, $resolver); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getScriptVersion(); } /** - * Flush all of the factory state like sections and stacks. + * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. * - * @return void + * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract + * the headers. The default null is left for backwards compatibility. * @static */ - public static function flushState() + public static function setHttpHeaders($httpHeaders = null) { - \Illuminate\View\Factory::flushState(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->setHttpHeaders($httpHeaders); } /** - * Flush all of the section contents if done rendering. + * Retrieves the HTTP headers. * - * @return void + * @return array * @static */ - public static function flushStateIfDoneRendering() + public static function getHttpHeaders() { - \Illuminate\View\Factory::flushStateIfDoneRendering(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getHttpHeaders(); } /** - * Get the extension to engine bindings. + * Retrieves a particular header. If it doesn't exist, no exception/error is caused. + * + * Simply null is returned. * - * @return array + * @param string $header The name of the header to retrieve. Can be HTTP compliant such as + * "User-Agent" or "X-Device-User-Agent" or can be php-esque with the + * all-caps, HTTP_ prefixed, underscore seperated awesomeness. + * @return string|null The value of the header. * @static */ - public static function getExtensions() + public static function getHttpHeader($header) { - return \Illuminate\View\Factory::getExtensions(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getHttpHeader($header); } /** - * Get the engine resolver instance. + * * - * @return \Illuminate\View\Engines\EngineResolver * @static */ - public static function getEngineResolver() + public static function getMobileHeaders() { - return \Illuminate\View\Factory::getEngineResolver(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getMobileHeaders(); } /** - * Get the view finder instance. + * Get all possible HTTP headers that + * can contain the User-Agent string. * - * @return \Illuminate\View\ViewFinderInterface + * @return array List of HTTP headers. * @static */ - public static function getFinder() + public static function getUaHttpHeaders() { - return \Illuminate\View\Factory::getFinder(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getUaHttpHeaders(); } /** - * Set the view finder instance. + * Set CloudFront headers + * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device * - * @param \Illuminate\View\ViewFinderInterface $finder - * @return void + * @param array $cfHeaders List of HTTP headers + * @return boolean If there were CloudFront headers to be set * @static */ - public static function setFinder($finder) + public static function setCfHeaders($cfHeaders = null) { - \Illuminate\View\Factory::setFinder($finder); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->setCfHeaders($cfHeaders); } /** - * Flush the cache of views located by the finder. + * Retrieves the cloudfront headers. * - * @return void + * @return array * @static */ - public static function flushFinderCache() + public static function getCfHeaders() { - \Illuminate\View\Factory::flushFinderCache(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getCfHeaders(); } /** - * Get the event dispatcher instance. + * Set the User-Agent to be used. * - * @return \Illuminate\Contracts\Events\Dispatcher + * @param string $userAgent The user agent string to set. + * @return string|null * @static */ - public static function getDispatcher() + public static function setUserAgent($userAgent = null) { - return \Illuminate\View\Factory::getDispatcher(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->setUserAgent($userAgent); } /** - * Set the event dispatcher instance. + * Retrieve the User-Agent. * - * @param \Illuminate\Contracts\Events\Dispatcher $events - * @return void + * @return string|null The user agent if it's set. * @static */ - public static function setDispatcher($events) + public static function getUserAgent() { - \Illuminate\View\Factory::setDispatcher($events); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getUserAgent(); } /** - * Get the IoC container instance. + * Set the detection type. Must be one of self::DETECTION_TYPE_MOBILE or + * self::DETECTION_TYPE_EXTENDED. Otherwise, nothing is set. * - * @return \Illuminate\Contracts\Container\Container + * @deprecated since version 2.6.9 + * @param string $type The type. Must be a self::DETECTION_TYPE_* constant. The default + * parameter is null which will default to self::DETECTION_TYPE_MOBILE. * @static */ - public static function getContainer() + public static function setDetectionType($type = null) { - return \Illuminate\View\Factory::getContainer(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->setDetectionType($type); } /** - * Set the IoC container instance. + * * - * @param \Illuminate\Contracts\Container\Container $container - * @return void * @static */ - public static function setContainer($container) + public static function getMatchingRegex() { - \Illuminate\View\Factory::setContainer($container); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getMatchingRegex(); } /** - * Get an item from the shared data. + * * - * @param string $key - * @param mixed $default - * @return mixed * @static */ - public static function shared($key, $default = null) + public static function getMatchesArray() { - return \Illuminate\View\Factory::shared($key, $default); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getMatchesArray(); } /** - * Get all of the shared data for the environment. + * Retrieve the list of known phone devices. * - * @return array + * @return array List of phone devices. * @static */ - public static function getShared() + public static function getPhoneDevices() { - return \Illuminate\View\Factory::getShared(); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getPhoneDevices(); } /** - * Register a view composer event. + * Retrieve the list of known tablet devices. * - * @param array|string $views - * @param \Closure|string $callback - * @return array + * @return array List of tablet devices. * @static */ - public static function composer($views, $callback) + public static function getTabletDevices() { - return \Illuminate\View\Factory::composer($views, $callback); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getTabletDevices(); } /** - * Register a view creator event. + * Alias for getBrowsers() method. * - * @param array|string $views - * @param \Closure|string $callback - * @return array + * @return array List of user agents. * @static */ - public static function creator($views, $callback) + public static function getUserAgents() { - return \Illuminate\View\Factory::creator($views, $callback); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getUserAgents(); } /** - * Start a component rendering process. + * Retrieve the list of known utilities. * - * @param string $name - * @param array $data - * @return void + * @return array List of utilities. * @static */ - public static function startComponent($name, $data = array()) + public static function getUtilities() { - \Illuminate\View\Factory::startComponent($name, $data); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getUtilities(); } /** - * Render the current component. + * Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). * - * @return string + * @deprecated since version 2.6.9 + * @return array All the rules (but not extended). * @static */ - public static function renderComponent() + public static function getMobileDetectionRules() { - return \Illuminate\View\Factory::renderComponent(); + //Method inherited from \Mobile_Detect + return \Jenssegers\Agent\Agent::getMobileDetectionRules(); } /** - * Start the slot rendering process. + * Method gets the mobile detection rules + utilities. + * + * The reason this is separate is because utilities rules + * don't necessary imply mobile. This method is used inside + * the new $detect->is('stuff') method. * - * @param string $name - * @param string|null $content - * @return void + * @deprecated since version 2.6.9 + * @return array All the rules + extended. * @static */ - public static function slot($name, $content = null) + public static function getMobileDetectionRulesExtended() { - \Illuminate\View\Factory::slot($name, $content); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->getMobileDetectionRulesExtended(); } /** - * Save the slot content for rendering. + * Check the HTTP headers for signs of mobile. + * + * This is the fastest mobile check possible; it's used + * inside isMobile() method. * - * @return void + * @return bool * @static */ - public static function endSlot() + public static function checkHttpHeadersForMobile() { - \Illuminate\View\Factory::endSlot(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->checkHttpHeadersForMobile(); } /** - * Register multiple view composers via an array. + * Check if the device is mobile. + * + * Returns true if any type of mobile device detected, including special ones * - * @param array $composers - * @return array + * @param null $userAgent deprecated + * @param null $httpHeaders deprecated + * @return bool * @static */ - public static function composers($composers) + public static function isMobile($userAgent = null, $httpHeaders = null) { - return \Illuminate\View\Factory::composers($composers); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->isMobile($userAgent, $httpHeaders); } /** - * Call the composer for a given view. + * Check if the device is a tablet. + * + * Return true if any type of tablet device is detected. * - * @param \Illuminate\Contracts\View\View $view - * @return void + * @param string $userAgent deprecated + * @param array $httpHeaders deprecated + * @return bool * @static */ - public static function callComposer($view) + public static function isTablet($userAgent = null, $httpHeaders = null) { - \Illuminate\View\Factory::callComposer($view); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->isTablet($userAgent, $httpHeaders); } /** - * Call the creator for a given view. + * This method checks for a certain property in the + * userAgent. * - * @param \Illuminate\Contracts\View\View $view - * @return void + * @todo : The httpHeaders part is not yet used. + * @param string $key + * @param string $userAgent deprecated + * @param string $httpHeaders deprecated + * @return bool|int|null * @static */ - public static function callCreator($view) + public static function is($key, $userAgent = null, $httpHeaders = null) { - \Illuminate\View\Factory::callCreator($view); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->is($key, $userAgent, $httpHeaders); } /** - * Start injecting content into a section. + * Some detection rules are relative (not standard), + * because of the diversity of devices, vendors and + * their conventions in representing the User-Agent or + * the HTTP headers. + * + * This method will be used to check custom regexes against + * the User-Agent string. * - * @param string $section - * @param string|null $content - * @return void + * @param $regex + * @param string $userAgent + * @return bool + * @todo : search in the HTTP headers too. * @static */ - public static function startSection($section, $content = null) + public static function match($regex, $userAgent = null) { - \Illuminate\View\Factory::startSection($section, $content); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->match($regex, $userAgent); } /** - * Inject inline content into a section. + * Prepare the version number. * - * @param string $section - * @param string $content - * @return void + * @todo Remove the error supression from str_replace() call. + * @param string $ver The string version, like "2.6.21.2152"; + * @return float * @static */ - public static function inject($section, $content) + public static function prepareVersionNo($ver) { - \Illuminate\View\Factory::inject($section, $content); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->prepareVersionNo($ver); } /** - * Stop injecting content into a section and return its contents. + * Retrieve the mobile grading, using self::MOBILE_GRADE_* constants. * - * @return string + * @return string One of the self::MOBILE_GRADE_* constants. * @static */ - public static function yieldSection() + public static function mobileGrade() { - return \Illuminate\View\Factory::yieldSection(); + //Method inherited from \Mobile_Detect + /** @var \Jenssegers\Agent\Agent $instance */ + return $instance->mobileGrade(); } + + } + +} + +namespace Mews\Purifier\Facades { + + /** + * + * + * @see \Mews\Purifier + */ + class Purifier { /** - * Stop injecting content into a section. + * * - * @param bool $overwrite - * @return string - * @throws \InvalidArgumentException + * @param $dirty + * @param null $config + * @return mixed * @static */ - public static function stopSection($overwrite = false) + public static function clean($dirty, $config = null) { - return \Illuminate\View\Factory::stopSection($overwrite); + /** @var \Mews\Purifier\Purifier $instance */ + return $instance->clean($dirty, $config); } /** - * Stop injecting content into a section and append it. + * Get HTMLPurifier instance. * - * @return string - * @throws \InvalidArgumentException + * @return \HTMLPurifier * @static */ - public static function appendSection() + public static function getInstance() { - return \Illuminate\View\Factory::appendSection(); + /** @var \Mews\Purifier\Purifier $instance */ + return $instance->getInstance(); } + + } + +} + +namespace Misechow\Geetest { + + /** + * + * + */ + class Geetest { /** - * Get the string contents of a section. + * * - * @param string $section - * @param string $default * @return string * @static */ - public static function yieldContent($section, $default = '') + public static function getGeetestUrl() { - return \Illuminate\View\Factory::yieldContent($section, $default); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->getGeetestUrl(); } /** - * Get the parent placeholder for the current request. + * * - * @param string $section - * @return string + * @param string $geetestUrl + * @return \Misechow\Geetest\GeetestLib * @static */ - public static function parentPlaceholder($section = '') + public static function setGeetestUrl($url) { - return \Illuminate\View\Factory::parentPlaceholder($section); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->setGeetestUrl($url); } /** - * Check if section exists. + * Check Geetest server is running or not. * - * @param string $name - * @return bool + * @param null $user_id + * @return int * @static */ - public static function hasSection($name) + public static function preProcess($param, $new_captcha = 1) { - return \Illuminate\View\Factory::hasSection($name); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->preProcess($param, $new_captcha); } /** - * Get the contents of a section. + * * - * @param string $name - * @param string $default * @return mixed * @static */ - public static function getSection($name, $default = null) + public static function getResponseStr() { - return \Illuminate\View\Factory::getSection($name, $default); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->getResponseStr(); } /** - * Get the entire array of sections. + * * - * @return array + * @return mixed * @static */ - public static function getSections() + public static function getResponse() { - return \Illuminate\View\Factory::getSections(); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->getResponse(); } /** - * Flush all of the sections. + * Get success validate result. * - * @return void + * @param $challenge + * @param $validate + * @param $seccode + * @param null $user_id + * @return int * @static */ - public static function flushSections() + public static function successValidate($challenge, $validate, $seccode, $param, $json_format = 1) { - \Illuminate\View\Factory::flushSections(); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->successValidate($challenge, $validate, $seccode, $param, $json_format); } /** - * Add new loop to the stack. + * Get fail result. * - * @param \Countable|array $data - * @return void + * @param $challenge + * @param $validate + * @param $seccode + * @return int * @static */ - public static function addLoop($data) + public static function failValidate($challenge, $validate, $seccode) { - \Illuminate\View\Factory::addLoop($data); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->failValidate($challenge, $validate, $seccode); } /** - * Increment the top loop's indices. + * * - * @return void + * @param string $product * @static */ - public static function incrementLoopIndices() + public static function render($product = 'float', $captchaId = 'geetest-captcha') { - \Illuminate\View\Factory::incrementLoopIndices(); + /** @var \Misechow\Geetest\GeetestLib $instance */ + return $instance->render($product, $captchaId); } + + } + +} + +namespace Misechow\NoCaptcha\Facades { + + /** + * + * + */ + class NoCaptcha { /** - * Pop a loop from the top of the loop stack. + * Render HTML captcha. * - * @return void + * @param array $attributes + * @return string * @static */ - public static function popLoop() + public static function display($attributes = array()) { - \Illuminate\View\Factory::popLoop(); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->display($attributes); } /** - * Get an instance of the last loop in the stack. + * * - * @return \stdClass|null + * @see display() * @static */ - public static function getLastLoop() + public static function displayWidget($attributes = array()) { - return \Illuminate\View\Factory::getLastLoop(); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->displayWidget($attributes); } /** - * Get the entire loop stack. + * Display a Invisible reCAPTCHA by embedding a callback into a form submit button. * - * @return array + * @param string $formIdentifier the html ID of the form that should be submitted. + * @param string $text the text inside the form button + * @param array $attributes array of additional html elements + * @return string * @static */ - public static function getLoopStack() + public static function displaySubmit($formIdentifier, $text = 'submit', $attributes = array()) { - return \Illuminate\View\Factory::getLoopStack(); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->displaySubmit($formIdentifier, $text, $attributes); } /** - * Start injecting content into a push section. + * Render js source * - * @param string $section - * @param string $content - * @return void + * @param null $lang + * @param bool $callback + * @param string $onLoadClass + * @return string * @static */ - public static function startPush($section, $content = '') + public static function renderJs($lang = null, $callback = false, $onLoadClass = 'onloadCallBack') { - \Illuminate\View\Factory::startPush($section, $content); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->renderJs($lang, $callback, $onLoadClass); } /** - * Stop injecting content into a push section. + * Verify no-captcha response. * - * @return string - * @throws \InvalidArgumentException + * @param string $response + * @param string $clientIp + * @return bool * @static */ - public static function stopPush() + public static function verifyResponse($response, $clientIp = null) { - return \Illuminate\View\Factory::stopPush(); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->verifyResponse($response, $clientIp); } /** - * Start prepending content into a push section. + * Verify no-captcha response by Symfony Request. * - * @param string $section - * @param string $content - * @return void + * @param \Request $request + * @return bool * @static */ - public static function startPrepend($section, $content = '') + public static function verifyRequest($request) { - \Illuminate\View\Factory::startPrepend($section, $content); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->verifyRequest($request); } /** - * Stop prepending content into a push section. + * Get recaptcha js link. * + * @param string $lang + * @param boolean $callback + * @param string $onLoadClass * @return string - * @throws \InvalidArgumentException * @static */ - public static function stopPrepend() + public static function getJsLink($lang = null, $callback = false, $onLoadClass = 'onloadCallBack') { - return \Illuminate\View\Factory::stopPrepend(); + /** @var \Misechow\NoCaptcha\NoCaptcha $instance */ + return $instance->getJsLink($lang, $callback, $onLoadClass); } + + } + +} + +namespace Intervention\Image\Facades { + + /** + * + * + */ + class Image { /** - * Get the string contents of a push section. + * Overrides configuration settings * - * @param string $section - * @param string $default - * @return string + * @param array $config + * @return self * @static */ - public static function yieldPushContent($section, $default = '') + public static function configure($config = array()) { - return \Illuminate\View\Factory::yieldPushContent($section, $default); + /** @var \Intervention\Image\ImageManager $instance */ + return $instance->configure($config); } /** - * Flush all of the stacks. + * Initiates an Image instance from different input types * - * @return void + * @param mixed $data + * @return \Intervention\Image\Image * @static */ - public static function flushStacks() + public static function make($data) { - \Illuminate\View\Factory::flushStacks(); + /** @var \Intervention\Image\ImageManager $instance */ + return $instance->make($data); } /** - * Start a translation block. + * Creates an empty image canvas * - * @param array $replacements - * @return void + * @param int $width + * @param int $height + * @param mixed $background + * @return \Intervention\Image\Image * @static */ - public static function startTranslation($replacements = array()) + public static function canvas($width, $height, $background = null) { - \Illuminate\View\Factory::startTranslation($replacements); + /** @var \Intervention\Image\ImageManager $instance */ + return $instance->canvas($width, $height, $background); } /** - * Render the current translation. + * Create new cached image and run callback + * (requires additional package intervention/imagecache) * - * @return string + * @param \Closure $callback + * @param int $lifetime + * @param boolean $returnObj + * @return \Image * @static */ - public static function renderTranslation() + public static function cache($callback, $lifetime = null, $returnObj = false) { - return \Illuminate\View\Factory::renderTranslation(); + /** @var \Intervention\Image\ImageManager $instance */ + return $instance->cache($callback, $lifetime, $returnObj); } } @@ -11588,8 +15260,9 @@ class Eloquent extends \Illuminate\Database\Eloquent\Model { * @static */ public static function make($attributes = array()) - { - return \Illuminate\Database\Eloquent\Builder::make($attributes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->make($attributes); } /** @@ -11597,36 +15270,39 @@ public static function make($attributes = array()) * * @param string $identifier * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function withGlobalScope($identifier, $scope) - { - return \Illuminate\Database\Eloquent\Builder::withGlobalScope($identifier, $scope); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->withGlobalScope($identifier, $scope); } /** * Remove a registered global scope. * * @param \Illuminate\Database\Eloquent\Scope|string $scope - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function withoutGlobalScope($scope) - { - return \Illuminate\Database\Eloquent\Builder::withoutGlobalScope($scope); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->withoutGlobalScope($scope); } /** * Remove all or passed registered global scopes. * * @param array|null $scopes - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function withoutGlobalScopes($scopes = null) - { - return \Illuminate\Database\Eloquent\Builder::withoutGlobalScopes($scopes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->withoutGlobalScopes($scopes); } /** @@ -11636,49 +15312,66 @@ public static function withoutGlobalScopes($scopes = null) * @static */ public static function removedScopes() - { - return \Illuminate\Database\Eloquent\Builder::removedScopes(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->removedScopes(); } /** * Add a where clause on the primary key to the query. * * @param mixed $id - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function whereKey($id) - { - return \Illuminate\Database\Eloquent\Builder::whereKey($id); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->whereKey($id); + } + + /** + * Add a where clause on the primary key to the query. + * + * @param mixed $id + * @return \Illuminate\Database\Eloquent\Builder + * @static + */ + public static function whereKeyNot($id) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->whereKeyNot($id); } /** * Add a basic where clause to the query. * * @param string|array|\Closure $column - * @param string $operator + * @param mixed $operator * @param mixed $value * @param string $boolean - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function where($column, $operator = null, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Eloquent\Builder::where($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->where($column, $operator, $value, $boolean); } /** * Add an "or where" clause to the query. * - * @param string|\Closure $column - * @param string $operator + * @param \Closure|array|string $column + * @param mixed $operator * @param mixed $value * @return \Illuminate\Database\Eloquent\Builder|static * @static */ public static function orWhere($column, $operator = null, $value = null) - { - return \Illuminate\Database\Eloquent\Builder::orWhere($column, $operator, $value); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->orWhere($column, $operator, $value); } /** @@ -11689,8 +15382,9 @@ public static function orWhere($column, $operator = null, $value = null) * @static */ public static function hydrate($items) - { - return \Illuminate\Database\Eloquent\Builder::hydrate($items); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->hydrate($items); } /** @@ -11702,8 +15396,9 @@ public static function hydrate($items) * @static */ public static function fromQuery($query, $bindings = array()) - { - return \Illuminate\Database\Eloquent\Builder::fromQuery($query, $bindings); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->fromQuery($query, $bindings); } /** @@ -11715,21 +15410,23 @@ public static function fromQuery($query, $bindings = array()) * @static */ public static function find($id, $columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::find($id, $columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->find($id, $columns); } /** * Find multiple models by their primary keys. * - * @param array $ids + * @param \Illuminate\Contracts\Support\Arrayable|array $ids * @param array $columns * @return \Illuminate\Database\Eloquent\Collection * @static */ public static function findMany($ids, $columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::findMany($ids, $columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->findMany($ids, $columns); } /** @@ -11737,13 +15434,14 @@ public static function findMany($ids, $columns = array()) * * @param mixed $id * @param array $columns - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * @static */ public static function findOrFail($id, $columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::findOrFail($id, $columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->findOrFail($id, $columns); } /** @@ -11755,8 +15453,9 @@ public static function findOrFail($id, $columns = array()) * @static */ public static function findOrNew($id, $columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::findOrNew($id, $columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->findOrNew($id, $columns); } /** @@ -11768,8 +15467,9 @@ public static function findOrNew($id, $columns = array()) * @static */ public static function firstOrNew($attributes, $values = array()) - { - return \Illuminate\Database\Eloquent\Builder::firstOrNew($attributes, $values); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->firstOrNew($attributes, $values); } /** @@ -11781,8 +15481,9 @@ public static function firstOrNew($attributes, $values = array()) * @static */ public static function firstOrCreate($attributes, $values = array()) - { - return \Illuminate\Database\Eloquent\Builder::firstOrCreate($attributes, $values); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->firstOrCreate($attributes, $values); } /** @@ -11794,8 +15495,9 @@ public static function firstOrCreate($attributes, $values = array()) * @static */ public static function updateOrCreate($attributes, $values = array()) - { - return \Illuminate\Database\Eloquent\Builder::updateOrCreate($attributes, $values); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->updateOrCreate($attributes, $values); } /** @@ -11807,8 +15509,9 @@ public static function updateOrCreate($attributes, $values = array()) * @static */ public static function firstOrFail($columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::firstOrFail($columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->firstOrFail($columns); } /** @@ -11820,8 +15523,9 @@ public static function firstOrFail($columns = array()) * @static */ public static function firstOr($columns = array(), $callback = null) - { - return \Illuminate\Database\Eloquent\Builder::firstOr($columns, $callback); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->firstOr($columns, $callback); } /** @@ -11832,8 +15536,9 @@ public static function firstOr($columns = array(), $callback = null) * @static */ public static function value($column) - { - return \Illuminate\Database\Eloquent\Builder::value($column); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->value($column); } /** @@ -11844,8 +15549,9 @@ public static function value($column) * @static */ public static function get($columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::get($columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->get($columns); } /** @@ -11856,8 +15562,9 @@ public static function get($columns = array()) * @static */ public static function getModels($columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::getModels($columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->getModels($columns); } /** @@ -11868,8 +15575,9 @@ public static function getModels($columns = array()) * @static */ public static function eagerLoadRelations($models) - { - return \Illuminate\Database\Eloquent\Builder::eagerLoadRelations($models); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->eagerLoadRelations($models); } /** @@ -11879,8 +15587,9 @@ public static function eagerLoadRelations($models) * @static */ public static function cursor() - { - return \Illuminate\Database\Eloquent\Builder::cursor(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->cursor(); } /** @@ -11888,14 +15597,15 @@ public static function cursor() * * @param int $count * @param callable $callback - * @param string $column + * @param string|null $column * @param string|null $alias * @return bool * @static */ public static function chunkById($count, $callback, $column = null, $alias = null) - { - return \Illuminate\Database\Eloquent\Builder::chunkById($count, $callback, $column, $alias); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->chunkById($count, $callback, $column, $alias); } /** @@ -11907,8 +15617,9 @@ public static function chunkById($count, $callback, $column = null, $alias = nul * @static */ public static function pluck($column, $key = null) - { - return \Illuminate\Database\Eloquent\Builder::pluck($column, $key); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->pluck($column, $key); } /** @@ -11923,8 +15634,9 @@ public static function pluck($column, $key = null) * @static */ public static function paginate($perPage = null, $columns = array(), $pageName = 'page', $page = null) - { - return \Illuminate\Database\Eloquent\Builder::paginate($perPage, $columns, $pageName, $page); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->paginate($perPage, $columns, $pageName, $page); } /** @@ -11938,32 +15650,35 @@ public static function paginate($perPage = null, $columns = array(), $pageName = * @static */ public static function simplePaginate($perPage = null, $columns = array(), $pageName = 'page', $page = null) - { - return \Illuminate\Database\Eloquent\Builder::simplePaginate($perPage, $columns, $pageName, $page); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->simplePaginate($perPage, $columns, $pageName, $page); } /** * Save a new model and return the instance. * * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|$this * @static */ public static function create($attributes = array()) - { - return \Illuminate\Database\Eloquent\Builder::create($attributes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->create($attributes); } /** * Save a new model and return the instance. Allow mass-assignment. * * @param array $attributes - * @return \Illuminate\Database\Eloquent\Model + * @return \Illuminate\Database\Eloquent\Model|$this * @static */ public static function forceCreate($attributes) - { - return \Illuminate\Database\Eloquent\Builder::forceCreate($attributes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->forceCreate($attributes); } /** @@ -11974,8 +15689,9 @@ public static function forceCreate($attributes) * @static */ public static function onDelete($callback) - { - \Illuminate\Database\Eloquent\Builder::onDelete($callback); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + $instance->onDelete($callback); } /** @@ -11986,8 +15702,9 @@ public static function onDelete($callback) * @static */ public static function scopes($scopes) - { - return \Illuminate\Database\Eloquent\Builder::scopes($scopes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->scopes($scopes); } /** @@ -11997,20 +15714,22 @@ public static function scopes($scopes) * @static */ public static function applyScopes() - { - return \Illuminate\Database\Eloquent\Builder::applyScopes(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->applyScopes(); } /** * Prevent the specified relations from being eager loaded. * * @param mixed $relations - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function without($relations) - { - return \Illuminate\Database\Eloquent\Builder::without($relations); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->without($relations); } /** @@ -12021,8 +15740,9 @@ public static function without($relations) * @static */ public static function newModelInstance($attributes = array()) - { - return \Illuminate\Database\Eloquent\Builder::newModelInstance($attributes); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->newModelInstance($attributes); } /** @@ -12032,20 +15752,22 @@ public static function newModelInstance($attributes = array()) * @static */ public static function getQuery() - { - return \Illuminate\Database\Eloquent\Builder::getQuery(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->getQuery(); } /** * Set the underlying query builder instance. * * @param \Illuminate\Database\Query\Builder $query - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function setQuery($query) - { - return \Illuminate\Database\Eloquent\Builder::setQuery($query); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->setQuery($query); } /** @@ -12055,8 +15777,9 @@ public static function setQuery($query) * @static */ public static function toBase() - { - return \Illuminate\Database\Eloquent\Builder::toBase(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->toBase(); } /** @@ -12066,20 +15789,22 @@ public static function toBase() * @static */ public static function getEagerLoads() - { - return \Illuminate\Database\Eloquent\Builder::getEagerLoads(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->getEagerLoads(); } /** * Set the relationships being eagerly loaded. * * @param array $eagerLoad - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function setEagerLoads($eagerLoad) - { - return \Illuminate\Database\Eloquent\Builder::setEagerLoads($eagerLoad); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->setEagerLoads($eagerLoad); } /** @@ -12089,20 +15814,22 @@ public static function setEagerLoads($eagerLoad) * @static */ public static function getModel() - { - return \Illuminate\Database\Eloquent\Builder::getModel(); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->getModel(); } /** * Set a model instance for the model being queried. * * @param \Illuminate\Database\Eloquent\Model $model - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function setModel($model) - { - return \Illuminate\Database\Eloquent\Builder::setModel($model); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->setModel($model); } /** @@ -12113,8 +15840,9 @@ public static function setModel($model) * @static */ public static function getMacro($name) - { - return \Illuminate\Database\Eloquent\Builder::getMacro($name); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->getMacro($name); } /** @@ -12126,8 +15854,9 @@ public static function getMacro($name) * @static */ public static function chunk($count, $callback) - { - return \Illuminate\Database\Eloquent\Builder::chunk($count, $callback); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->chunk($count, $callback); } /** @@ -12139,20 +15868,22 @@ public static function chunk($count, $callback) * @static */ public static function each($callback, $count = 1000) - { - return \Illuminate\Database\Eloquent\Builder::each($callback, $count); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->each($callback, $count); } /** * Execute the query and get the first result. * * @param array $columns - * @return mixed + * @return \Illuminate\Database\Eloquent\Model|object|static|null * @static */ public static function first($columns = array()) - { - return \Illuminate\Database\Eloquent\Builder::first($columns); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->first($columns); } /** @@ -12161,12 +15892,41 @@ public static function first($columns = array()) * @param mixed $value * @param callable $callback * @param callable $default - * @return mixed + * @return mixed|$this * @static */ public static function when($value, $callback, $default = null) - { - return \Illuminate\Database\Eloquent\Builder::when($value, $callback, $default); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->when($value, $callback, $default); + } + + /** + * Pass the query to a given callback. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function tap($callback) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->tap($callback); + } + + /** + * Apply the callback's query changes if the given "value" is false. + * + * @param mixed $value + * @param callable $callback + * @param callable $default + * @return mixed|$this + * @static + */ + public static function unless($value, $callback, $default = null) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->unless($value, $callback, $default); } /** @@ -12181,8 +15941,9 @@ public static function when($value, $callback, $default = null) * @static */ public static function has($relation, $operator = '>=', $count = 1, $boolean = 'and', $callback = null) - { - return \Illuminate\Database\Eloquent\Builder::has($relation, $operator, $count, $boolean, $callback); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->has($relation, $operator, $count, $boolean, $callback); } /** @@ -12195,8 +15956,9 @@ public static function has($relation, $operator = '>=', $count = 1, $boolean = ' * @static */ public static function orHas($relation, $operator = '>=', $count = 1) - { - return \Illuminate\Database\Eloquent\Builder::orHas($relation, $operator, $count); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->orHas($relation, $operator, $count); } /** @@ -12208,9 +15970,23 @@ public static function orHas($relation, $operator = '>=', $count = 1) * @return \Illuminate\Database\Eloquent\Builder|static * @static */ - public static function doesntHave($relation, $boolean = 'and', $callback = null) - { - return \Illuminate\Database\Eloquent\Builder::doesntHave($relation, $boolean, $callback); + public static function doesntHave($relation, $boolean = 'and', $callback = null) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->doesntHave($relation, $boolean, $callback); + } + + /** + * Add a relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Builder|static + * @static + */ + public static function orDoesntHave($relation) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->orDoesntHave($relation); } /** @@ -12224,8 +16000,9 @@ public static function doesntHave($relation, $boolean = 'and', $callback = null) * @static */ public static function whereHas($relation, $callback = null, $operator = '>=', $count = 1) - { - return \Illuminate\Database\Eloquent\Builder::whereHas($relation, $callback, $operator, $count); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->whereHas($relation, $callback, $operator, $count); } /** @@ -12239,8 +16016,9 @@ public static function whereHas($relation, $callback = null, $operator = '>=', $ * @static */ public static function orWhereHas($relation, $callback = null, $operator = '>=', $count = 1) - { - return \Illuminate\Database\Eloquent\Builder::orWhereHas($relation, $callback, $operator, $count); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->orWhereHas($relation, $callback, $operator, $count); } /** @@ -12252,20 +16030,36 @@ public static function orWhereHas($relation, $callback = null, $operator = '>=', * @static */ public static function whereDoesntHave($relation, $callback = null) - { - return \Illuminate\Database\Eloquent\Builder::whereDoesntHave($relation, $callback); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->whereDoesntHave($relation, $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @return \Illuminate\Database\Eloquent\Builder|static + * @static + */ + public static function orWhereDoesntHave($relation, $callback = null) + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->orWhereDoesntHave($relation, $callback); } /** * Add subselect queries to count the relations. * * @param mixed $relations - * @return $this + * @return \Illuminate\Database\Eloquent\Builder * @static */ public static function withCount($relations) - { - return \Illuminate\Database\Eloquent\Builder::withCount($relations); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->withCount($relations); } /** @@ -12276,20 +16070,37 @@ public static function withCount($relations) * @static */ public static function mergeConstraintsFrom($from) - { - return \Illuminate\Database\Eloquent\Builder::mergeConstraintsFrom($from); + { + /** @var \Illuminate\Database\Eloquent\Builder $instance */ + return $instance->mergeConstraintsFrom($from); } /** * Set the columns to be selected. * * @param array|mixed $columns - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function select($columns = array()) - { - return \Illuminate\Database\Query\Builder::select($columns); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->select($columns); + } + + /** + * Add a subselect expression to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + * @throws \InvalidArgumentException + * @static + */ + public static function selectSub($query, $as) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->selectSub($query, $as); } /** @@ -12301,12 +16112,13 @@ public static function select($columns = array()) * @static */ public static function selectRaw($expression, $bindings = array()) - { - return \Illuminate\Database\Query\Builder::selectRaw($expression, $bindings); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->selectRaw($expression, $bindings); } /** - * Add a subselect expression to the query. + * Makes "from" fetch from a subquery. * * @param \Closure|\Illuminate\Database\Query\Builder|string $query * @param string $as @@ -12314,44 +16126,62 @@ public static function selectRaw($expression, $bindings = array()) * @throws \InvalidArgumentException * @static */ - public static function selectSub($query, $as) - { - return \Illuminate\Database\Query\Builder::selectSub($query, $as); + public static function fromSub($query, $as) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->fromSub($query, $as); + } + + /** + * Add a raw from clause to the query. + * + * @param string $expression + * @param mixed $bindings + * @return \Illuminate\Database\Query\Builder|static + * @static + */ + public static function fromRaw($expression, $bindings = array()) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->fromRaw($expression, $bindings); } /** * Add a new select column to the query. * * @param array|mixed $column - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function addSelect($column) - { - return \Illuminate\Database\Query\Builder::addSelect($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->addSelect($column); } /** * Force the query to only return distinct results. * - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function distinct() - { - return \Illuminate\Database\Query\Builder::distinct(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->distinct(); } /** * Set the table which the query is targeting. * * @param string $table - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function from($table) - { - return \Illuminate\Database\Query\Builder::from($table); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->from($table); } /** @@ -12359,16 +16189,17 @@ public static function from($table) * * @param string $table * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @param string $type * @param bool $where - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) - { - return \Illuminate\Database\Query\Builder::join($table, $first, $operator, $second, $type, $where); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->join($table, $first, $operator, $second, $type, $where); } /** @@ -12383,8 +16214,29 @@ public static function join($table, $first, $operator = null, $second = null, $t * @static */ public static function joinWhere($table, $first, $operator, $second, $type = 'inner') - { - return \Illuminate\Database\Query\Builder::joinWhere($table, $first, $operator, $second, $type); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->joinWhere($table, $first, $operator, $second, $type); + } + + /** + * Add a subquery join clause to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return \Illuminate\Database\Query\Builder|static + * @throws \InvalidArgumentException + * @static + */ + public static function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->joinSub($query, $as, $first, $operator, $second, $type, $where); } /** @@ -12392,14 +16244,15 @@ public static function joinWhere($table, $first, $operator, $second, $type = 'in * * @param string $table * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @return \Illuminate\Database\Query\Builder|static * @static */ public static function leftJoin($table, $first, $operator = null, $second = null) - { - return \Illuminate\Database\Query\Builder::leftJoin($table, $first, $operator, $second); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->leftJoin($table, $first, $operator, $second); } /** @@ -12413,8 +16266,26 @@ public static function leftJoin($table, $first, $operator = null, $second = null * @static */ public static function leftJoinWhere($table, $first, $operator, $second) - { - return \Illuminate\Database\Query\Builder::leftJoinWhere($table, $first, $operator, $second); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->leftJoinWhere($table, $first, $operator, $second); + } + + /** + * Add a subquery left join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + * @static + */ + public static function leftJoinSub($query, $as, $first, $operator = null, $second = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->leftJoinSub($query, $as, $first, $operator, $second); } /** @@ -12422,14 +16293,15 @@ public static function leftJoinWhere($table, $first, $operator, $second) * * @param string $table * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @return \Illuminate\Database\Query\Builder|static * @static */ public static function rightJoin($table, $first, $operator = null, $second = null) - { - return \Illuminate\Database\Query\Builder::rightJoin($table, $first, $operator, $second); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->rightJoin($table, $first, $operator, $second); } /** @@ -12443,35 +16315,42 @@ public static function rightJoin($table, $first, $operator = null, $second = nul * @static */ public static function rightJoinWhere($table, $first, $operator, $second) - { - return \Illuminate\Database\Query\Builder::rightJoinWhere($table, $first, $operator, $second); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->rightJoinWhere($table, $first, $operator, $second); } /** - * Add a "cross join" clause to the query. + * Add a subquery right join to the query. * - * @param string $table + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @return \Illuminate\Database\Query\Builder|static * @static */ - public static function crossJoin($table, $first = null, $operator = null, $second = null) - { - return \Illuminate\Database\Query\Builder::crossJoin($table, $first, $operator, $second); + public static function rightJoinSub($query, $as, $first, $operator = null, $second = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->rightJoinSub($query, $as, $first, $operator, $second); } /** - * Pass the query to a given callback. + * Add a "cross join" clause to the query. * - * @param \Closure $callback - * @return \Illuminate\Database\Query\Builder + * @param string $table + * @param string|null $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static * @static */ - public static function tap($callback) - { - return \Illuminate\Database\Query\Builder::tap($callback); + public static function crossJoin($table, $first = null, $operator = null, $second = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->crossJoin($table, $first, $operator, $second); } /** @@ -12483,8 +16362,25 @@ public static function tap($callback) * @static */ public static function mergeWheres($wheres, $bindings) - { - \Illuminate\Database\Query\Builder::mergeWheres($wheres, $bindings); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + $instance->mergeWheres($wheres, $bindings); + } + + /** + * Prepare the value and operator for a where clause. + * + * @param string $value + * @param string $operator + * @param bool $useDefault + * @return array + * @throws \InvalidArgumentException + * @static + */ + public static function prepareValueAndOperator($value, $operator, $useDefault = false) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->prepareValueAndOperator($value, $operator, $useDefault); } /** @@ -12498,8 +16394,9 @@ public static function mergeWheres($wheres, $bindings) * @static */ public static function whereColumn($first, $operator = null, $second = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereColumn($first, $operator, $second, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereColumn($first, $operator, $second, $boolean); } /** @@ -12512,8 +16409,9 @@ public static function whereColumn($first, $operator = null, $second = null, $bo * @static */ public static function orWhereColumn($first, $operator = null, $second = null) - { - return \Illuminate\Database\Query\Builder::orWhereColumn($first, $operator, $second); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereColumn($first, $operator, $second); } /** @@ -12522,25 +16420,27 @@ public static function orWhereColumn($first, $operator = null, $second = null) * @param string $sql * @param mixed $bindings * @param string $boolean - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function whereRaw($sql, $bindings = array(), $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereRaw($sql, $bindings, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereRaw($sql, $bindings, $boolean); } /** * Add a raw or where clause to the query. * * @param string $sql - * @param array $bindings + * @param mixed $bindings * @return \Illuminate\Database\Query\Builder|static * @static */ public static function orWhereRaw($sql, $bindings = array()) - { - return \Illuminate\Database\Query\Builder::orWhereRaw($sql, $bindings); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereRaw($sql, $bindings); } /** @@ -12550,12 +16450,13 @@ public static function orWhereRaw($sql, $bindings = array()) * @param mixed $values * @param string $boolean * @param bool $not - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function whereIn($column, $values, $boolean = 'and', $not = false) - { - return \Illuminate\Database\Query\Builder::whereIn($column, $values, $boolean, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereIn($column, $values, $boolean, $not); } /** @@ -12567,8 +16468,9 @@ public static function whereIn($column, $values, $boolean = 'and', $not = false) * @static */ public static function orWhereIn($column, $values) - { - return \Illuminate\Database\Query\Builder::orWhereIn($column, $values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereIn($column, $values); } /** @@ -12581,8 +16483,9 @@ public static function orWhereIn($column, $values) * @static */ public static function whereNotIn($column, $values, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereNotIn($column, $values, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNotIn($column, $values, $boolean); } /** @@ -12594,8 +16497,9 @@ public static function whereNotIn($column, $values, $boolean = 'and') * @static */ public static function orWhereNotIn($column, $values) - { - return \Illuminate\Database\Query\Builder::orWhereNotIn($column, $values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereNotIn($column, $values); } /** @@ -12604,12 +16508,13 @@ public static function orWhereNotIn($column, $values) * @param string $column * @param string $boolean * @param bool $not - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function whereNull($column, $boolean = 'and', $not = false) - { - return \Illuminate\Database\Query\Builder::whereNull($column, $boolean, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNull($column, $boolean, $not); } /** @@ -12620,8 +16525,9 @@ public static function whereNull($column, $boolean = 'and', $not = false) * @static */ public static function orWhereNull($column) - { - return \Illuminate\Database\Query\Builder::orWhereNull($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereNull($column); } /** @@ -12633,8 +16539,9 @@ public static function orWhereNull($column) * @static */ public static function whereNotNull($column, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereNotNull($column, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNotNull($column, $boolean); } /** @@ -12644,12 +16551,13 @@ public static function whereNotNull($column, $boolean = 'and') * @param array $values * @param string $boolean * @param bool $not - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function whereBetween($column, $values, $boolean = 'and', $not = false) - { - return \Illuminate\Database\Query\Builder::whereBetween($column, $values, $boolean, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereBetween($column, $values, $boolean, $not); } /** @@ -12661,8 +16569,9 @@ public static function whereBetween($column, $values, $boolean = 'and', $not = f * @static */ public static function orWhereBetween($column, $values) - { - return \Illuminate\Database\Query\Builder::orWhereBetween($column, $values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereBetween($column, $values); } /** @@ -12675,8 +16584,9 @@ public static function orWhereBetween($column, $values) * @static */ public static function whereNotBetween($column, $values, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereNotBetween($column, $values, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNotBetween($column, $values, $boolean); } /** @@ -12688,8 +16598,9 @@ public static function whereNotBetween($column, $values, $boolean = 'and') * @static */ public static function orWhereNotBetween($column, $values) - { - return \Illuminate\Database\Query\Builder::orWhereNotBetween($column, $values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereNotBetween($column, $values); } /** @@ -12700,8 +16611,9 @@ public static function orWhereNotBetween($column, $values) * @static */ public static function orWhereNotNull($column) - { - return \Illuminate\Database\Query\Builder::orWhereNotNull($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereNotNull($column); } /** @@ -12715,8 +16627,9 @@ public static function orWhereNotNull($column) * @static */ public static function whereDate($column, $operator, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereDate($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereDate($column, $operator, $value, $boolean); } /** @@ -12724,13 +16637,14 @@ public static function whereDate($column, $operator, $value = null, $boolean = ' * * @param string $column * @param string $operator - * @param string $value + * @param mixed $value * @return \Illuminate\Database\Query\Builder|static * @static */ - public static function orWhereDate($column, $operator, $value) - { - return \Illuminate\Database\Query\Builder::orWhereDate($column, $operator, $value); + public static function orWhereDate($column, $operator, $value = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereDate($column, $operator, $value); } /** @@ -12738,14 +16652,15 @@ public static function orWhereDate($column, $operator, $value) * * @param string $column * @param string $operator - * @param int $value + * @param mixed $value * @param string $boolean * @return \Illuminate\Database\Query\Builder|static * @static */ - public static function whereTime($column, $operator, $value, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereTime($column, $operator, $value, $boolean); + public static function whereTime($column, $operator, $value = null, $boolean = 'and') + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereTime($column, $operator, $value, $boolean); } /** @@ -12753,13 +16668,14 @@ public static function whereTime($column, $operator, $value, $boolean = 'and') * * @param string $column * @param string $operator - * @param int $value + * @param mixed $value * @return \Illuminate\Database\Query\Builder|static * @static */ - public static function orWhereTime($column, $operator, $value) - { - return \Illuminate\Database\Query\Builder::orWhereTime($column, $operator, $value); + public static function orWhereTime($column, $operator, $value = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereTime($column, $operator, $value); } /** @@ -12773,8 +16689,24 @@ public static function orWhereTime($column, $operator, $value) * @static */ public static function whereDay($column, $operator, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereDay($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereDay($column, $operator, $value, $boolean); + } + + /** + * Add an "or where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + * @static + */ + public static function orWhereDay($column, $operator, $value = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereDay($column, $operator, $value); } /** @@ -12788,8 +16720,24 @@ public static function whereDay($column, $operator, $value = null, $boolean = 'a * @static */ public static function whereMonth($column, $operator, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereMonth($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereMonth($column, $operator, $value, $boolean); + } + + /** + * Add an "or where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + * @static + */ + public static function orWhereMonth($column, $operator, $value = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereMonth($column, $operator, $value); } /** @@ -12803,8 +16751,24 @@ public static function whereMonth($column, $operator, $value = null, $boolean = * @static */ public static function whereYear($column, $operator, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereYear($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereYear($column, $operator, $value, $boolean); + } + + /** + * Add an "or where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + * @static + */ + public static function orWhereYear($column, $operator, $value = null) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereYear($column, $operator, $value); } /** @@ -12816,8 +16780,9 @@ public static function whereYear($column, $operator, $value = null, $boolean = ' * @static */ public static function whereNested($callback, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereNested($callback, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNested($callback, $boolean); } /** @@ -12827,8 +16792,9 @@ public static function whereNested($callback, $boolean = 'and') * @static */ public static function forNestedWhere() - { - return \Illuminate\Database\Query\Builder::forNestedWhere(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->forNestedWhere(); } /** @@ -12836,12 +16802,13 @@ public static function forNestedWhere() * * @param \Illuminate\Database\Query\Builder|static $query * @param string $boolean - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function addNestedWhereQuery($query, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::addNestedWhereQuery($query, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->addNestedWhereQuery($query, $boolean); } /** @@ -12850,12 +16817,13 @@ public static function addNestedWhereQuery($query, $boolean = 'and') * @param \Closure $callback * @param string $boolean * @param bool $not - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function whereExists($callback, $boolean = 'and', $not = false) - { - return \Illuminate\Database\Query\Builder::whereExists($callback, $boolean, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereExists($callback, $boolean, $not); } /** @@ -12867,8 +16835,9 @@ public static function whereExists($callback, $boolean = 'and', $not = false) * @static */ public static function orWhereExists($callback, $not = false) - { - return \Illuminate\Database\Query\Builder::orWhereExists($callback, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereExists($callback, $not); } /** @@ -12880,8 +16849,9 @@ public static function orWhereExists($callback, $not = false) * @static */ public static function whereNotExists($callback, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::whereNotExists($callback, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereNotExists($callback, $boolean); } /** @@ -12892,8 +16862,9 @@ public static function whereNotExists($callback, $boolean = 'and') * @static */ public static function orWhereNotExists($callback) - { - return \Illuminate\Database\Query\Builder::orWhereNotExists($callback); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereNotExists($callback); } /** @@ -12902,12 +16873,103 @@ public static function orWhereNotExists($callback) * @param \Illuminate\Database\Query\Builder $query * @param string $boolean * @param bool $not - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function addWhereExistsQuery($query, $boolean = 'and', $not = false) - { - return \Illuminate\Database\Query\Builder::addWhereExistsQuery($query, $boolean, $not); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->addWhereExistsQuery($query, $boolean, $not); + } + + /** + * Adds a where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function whereRowValues($columns, $operator, $values, $boolean = 'and') + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereRowValues($columns, $operator, $values, $boolean); + } + + /** + * Adds a or where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function orWhereRowValues($columns, $operator, $values) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereRowValues($columns, $operator, $values); + } + + /** + * Add a "where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @param bool $not + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function whereJsonContains($column, $value, $boolean = 'and', $not = false) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereJsonContains($column, $value, $boolean, $not); + } + + /** + * Add a "or where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function orWhereJsonContains($column, $value) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereJsonContains($column, $value); + } + + /** + * Add a "where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function whereJsonDoesntContain($column, $value, $boolean = 'and') + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->whereJsonDoesntContain($column, $value, $boolean); + } + + /** + * Add a "or where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return \Illuminate\Database\Query\Builder + * @static + */ + public static function orWhereJsonDoesntContain($column, $value) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orWhereJsonDoesntContain($column, $value); } /** @@ -12915,53 +16977,57 @@ public static function addWhereExistsQuery($query, $boolean = 'and', $not = fals * * @param string $method * @param string $parameters - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function dynamicWhere($method, $parameters) - { - return \Illuminate\Database\Query\Builder::dynamicWhere($method, $parameters); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->dynamicWhere($method, $parameters); } /** * Add a "group by" clause to the query. * * @param array $groups - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function groupBy($groups = null) - { - return \Illuminate\Database\Query\Builder::groupBy($groups); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->groupBy($groups); } /** * Add a "having" clause to the query. * * @param string $column - * @param string $operator - * @param string $value + * @param string|null $operator + * @param string|null $value * @param string $boolean - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function having($column, $operator = null, $value = null, $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::having($column, $operator, $value, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->having($column, $operator, $value, $boolean); } /** * Add a "or having" clause to the query. * * @param string $column - * @param string $operator - * @param string $value + * @param string|null $operator + * @param string|null $value * @return \Illuminate\Database\Query\Builder|static * @static */ public static function orHaving($column, $operator = null, $value = null) - { - return \Illuminate\Database\Query\Builder::orHaving($column, $operator, $value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orHaving($column, $operator, $value); } /** @@ -12970,12 +17036,13 @@ public static function orHaving($column, $operator = null, $value = null) * @param string $sql * @param array $bindings * @param string $boolean - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function havingRaw($sql, $bindings = array(), $boolean = 'and') - { - return \Illuminate\Database\Query\Builder::havingRaw($sql, $bindings, $boolean); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->havingRaw($sql, $bindings, $boolean); } /** @@ -12987,8 +17054,9 @@ public static function havingRaw($sql, $bindings = array(), $boolean = 'and') * @static */ public static function orHavingRaw($sql, $bindings = array()) - { - return \Illuminate\Database\Query\Builder::orHavingRaw($sql, $bindings); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orHavingRaw($sql, $bindings); } /** @@ -12996,24 +17064,26 @@ public static function orHavingRaw($sql, $bindings = array()) * * @param string $column * @param string $direction - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function orderBy($column, $direction = 'asc') - { - return \Illuminate\Database\Query\Builder::orderBy($column, $direction); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orderBy($column, $direction); } /** * Add a descending "order by" clause to the query. * * @param string $column - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function orderByDesc($column) - { - return \Illuminate\Database\Query\Builder::orderByDesc($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orderByDesc($column); } /** @@ -13024,8 +17094,9 @@ public static function orderByDesc($column) * @static */ public static function latest($column = 'created_at') - { - return \Illuminate\Database\Query\Builder::latest($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->latest($column); } /** @@ -13036,20 +17107,22 @@ public static function latest($column = 'created_at') * @static */ public static function oldest($column = 'created_at') - { - return \Illuminate\Database\Query\Builder::oldest($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->oldest($column); } /** * Put the query's results in random order. * * @param string $seed - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function inRandomOrder($seed = '') - { - return \Illuminate\Database\Query\Builder::inRandomOrder($seed); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->inRandomOrder($seed); } /** @@ -13057,12 +17130,13 @@ public static function inRandomOrder($seed = '') * * @param string $sql * @param array $bindings - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function orderByRaw($sql, $bindings = array()) - { - return \Illuminate\Database\Query\Builder::orderByRaw($sql, $bindings); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->orderByRaw($sql, $bindings); } /** @@ -13073,20 +17147,22 @@ public static function orderByRaw($sql, $bindings = array()) * @static */ public static function skip($value) - { - return \Illuminate\Database\Query\Builder::skip($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->skip($value); } /** * Set the "offset" value of the query. * * @param int $value - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function offset($value) - { - return \Illuminate\Database\Query\Builder::offset($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->offset($value); } /** @@ -13097,20 +17173,22 @@ public static function offset($value) * @static */ public static function take($value) - { - return \Illuminate\Database\Query\Builder::take($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->take($value); } /** * Set the "limit" value of the query. * * @param int $value - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function limit($value) - { - return \Illuminate\Database\Query\Builder::limit($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->limit($value); } /** @@ -13122,22 +17200,24 @@ public static function limit($value) * @static */ public static function forPage($page, $perPage = 15) - { - return \Illuminate\Database\Query\Builder::forPage($page, $perPage); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->forPage($page, $perPage); } /** * Constrain the query to the next "page" of results after a given ID. * * @param int $perPage - * @param int $lastId + * @param int|null $lastId * @param string $column * @return \Illuminate\Database\Query\Builder|static * @static */ public static function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') - { - return \Illuminate\Database\Query\Builder::forPageAfterId($perPage, $lastId, $column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->forPageAfterId($perPage, $lastId, $column); } /** @@ -13149,8 +17229,9 @@ public static function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id' * @static */ public static function union($query, $all = false) - { - return \Illuminate\Database\Query\Builder::union($query, $all); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->union($query, $all); } /** @@ -13161,20 +17242,22 @@ public static function union($query, $all = false) * @static */ public static function unionAll($query) - { - return \Illuminate\Database\Query\Builder::unionAll($query); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->unionAll($query); } /** * Lock the selected rows in the table. * * @param string|bool $value - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function lock($value = true) - { - return \Illuminate\Database\Query\Builder::lock($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->lock($value); } /** @@ -13184,8 +17267,9 @@ public static function lock($value = true) * @static */ public static function lockForUpdate() - { - return \Illuminate\Database\Query\Builder::lockForUpdate(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->lockForUpdate(); } /** @@ -13195,8 +17279,9 @@ public static function lockForUpdate() * @static */ public static function sharedLock() - { - return \Illuminate\Database\Query\Builder::sharedLock(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->sharedLock(); } /** @@ -13206,8 +17291,9 @@ public static function sharedLock() * @static */ public static function toSql() - { - return \Illuminate\Database\Query\Builder::toSql(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->toSql(); } /** @@ -13218,8 +17304,9 @@ public static function toSql() * @static */ public static function getCountForPagination($columns = array()) - { - return \Illuminate\Database\Query\Builder::getCountForPagination($columns); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->getCountForPagination($columns); } /** @@ -13231,8 +17318,9 @@ public static function getCountForPagination($columns = array()) * @static */ public static function implode($column, $glue = '') - { - return \Illuminate\Database\Query\Builder::implode($column, $glue); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->implode($column, $glue); } /** @@ -13242,8 +17330,21 @@ public static function implode($column, $glue = '') * @static */ public static function exists() - { - return \Illuminate\Database\Query\Builder::exists(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->exists(); + } + + /** + * Determine if no rows exist for the current query. + * + * @return bool + * @static + */ + public static function doesntExist() + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->doesntExist(); } /** @@ -13254,8 +17355,9 @@ public static function exists() * @static */ public static function count($columns = '*') - { - return \Illuminate\Database\Query\Builder::count($columns); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->count($columns); } /** @@ -13266,8 +17368,9 @@ public static function count($columns = '*') * @static */ public static function min($column) - { - return \Illuminate\Database\Query\Builder::min($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->min($column); } /** @@ -13278,8 +17381,9 @@ public static function min($column) * @static */ public static function max($column) - { - return \Illuminate\Database\Query\Builder::max($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->max($column); } /** @@ -13290,8 +17394,9 @@ public static function max($column) * @static */ public static function sum($column) - { - return \Illuminate\Database\Query\Builder::sum($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->sum($column); } /** @@ -13302,8 +17407,9 @@ public static function sum($column) * @static */ public static function avg($column) - { - return \Illuminate\Database\Query\Builder::avg($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->avg($column); } /** @@ -13314,8 +17420,9 @@ public static function avg($column) * @static */ public static function average($column) - { - return \Illuminate\Database\Query\Builder::average($column); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->average($column); } /** @@ -13327,8 +17434,9 @@ public static function average($column) * @static */ public static function aggregate($function, $columns = array()) - { - return \Illuminate\Database\Query\Builder::aggregate($function, $columns); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->aggregate($function, $columns); } /** @@ -13340,8 +17448,9 @@ public static function aggregate($function, $columns = array()) * @static */ public static function numericAggregate($function, $columns = array()) - { - return \Illuminate\Database\Query\Builder::numericAggregate($function, $columns); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->numericAggregate($function, $columns); } /** @@ -13352,21 +17461,23 @@ public static function numericAggregate($function, $columns = array()) * @static */ public static function insert($values) - { - return \Illuminate\Database\Query\Builder::insert($values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->insert($values); } /** * Insert a new record and get the value of the primary key. * * @param array $values - * @param string $sequence + * @param string|null $sequence * @return int * @static */ public static function insertGetId($values, $sequence = null) - { - return \Illuminate\Database\Query\Builder::insertGetId($values, $sequence); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->insertGetId($values, $sequence); } /** @@ -13378,8 +17489,9 @@ public static function insertGetId($values, $sequence = null) * @static */ public static function updateOrInsert($attributes, $values = array()) - { - return \Illuminate\Database\Query\Builder::updateOrInsert($attributes, $values); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->updateOrInsert($attributes, $values); } /** @@ -13389,8 +17501,9 @@ public static function updateOrInsert($attributes, $values = array()) * @static */ public static function truncate() - { - \Illuminate\Database\Query\Builder::truncate(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + $instance->truncate(); } /** @@ -13401,8 +17514,9 @@ public static function truncate() * @static */ public static function raw($value) - { - return \Illuminate\Database\Query\Builder::raw($value); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->raw($value); } /** @@ -13412,8 +17526,9 @@ public static function raw($value) * @static */ public static function getBindings() - { - return \Illuminate\Database\Query\Builder::getBindings(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->getBindings(); } /** @@ -13423,8 +17538,9 @@ public static function getBindings() * @static */ public static function getRawBindings() - { - return \Illuminate\Database\Query\Builder::getRawBindings(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->getRawBindings(); } /** @@ -13432,13 +17548,14 @@ public static function getRawBindings() * * @param array $bindings * @param string $type - * @return $this + * @return \Illuminate\Database\Query\Builder * @throws \InvalidArgumentException * @static */ public static function setBindings($bindings, $type = 'where') - { - return \Illuminate\Database\Query\Builder::setBindings($bindings, $type); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->setBindings($bindings, $type); } /** @@ -13446,25 +17563,27 @@ public static function setBindings($bindings, $type = 'where') * * @param mixed $value * @param string $type - * @return $this + * @return \Illuminate\Database\Query\Builder * @throws \InvalidArgumentException * @static */ public static function addBinding($value, $type = 'where') - { - return \Illuminate\Database\Query\Builder::addBinding($value, $type); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->addBinding($value, $type); } /** * Merge an array of bindings into our bindings. * * @param \Illuminate\Database\Query\Builder $query - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function mergeBindings($query) - { - return \Illuminate\Database\Query\Builder::mergeBindings($query); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->mergeBindings($query); } /** @@ -13474,8 +17593,9 @@ public static function mergeBindings($query) * @static */ public static function getProcessor() - { - return \Illuminate\Database\Query\Builder::getProcessor(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->getProcessor(); } /** @@ -13485,31 +17605,34 @@ public static function getProcessor() * @static */ public static function getGrammar() - { - return \Illuminate\Database\Query\Builder::getGrammar(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->getGrammar(); } /** * Use the write pdo for query. * - * @return $this + * @return \Illuminate\Database\Query\Builder * @static */ public static function useWritePdo() - { - return \Illuminate\Database\Query\Builder::useWritePdo(); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->useWritePdo(); } /** * Clone the query without the given properties. * - * @param array $except + * @param array $properties * @return static * @static */ - public static function cloneWithout($except) - { - return \Illuminate\Database\Query\Builder::cloneWithout($except); + public static function cloneWithout($properties) + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->cloneWithout($properties); } /** @@ -13520,21 +17643,35 @@ public static function cloneWithout($except) * @static */ public static function cloneWithoutBindings($except) - { - return \Illuminate\Database\Query\Builder::cloneWithoutBindings($except); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->cloneWithoutBindings($except); } /** * Register a custom macro. * * @param string $name - * @param callable $macro + * @param object|callable $macro * @return void * @static */ public static function macro($name, $macro) - { - \Illuminate\Database\Query\Builder::macro($name, $macro); + { + \Illuminate\Database\Query\Builder::macro($name, $macro); + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @return void + * @throws \ReflectionException + * @static + */ + public static function mixin($mixin) + { + \Illuminate\Database\Query\Builder::mixin($mixin); } /** @@ -13545,8 +17682,8 @@ public static function macro($name, $macro) * @static */ public static function hasMacro($name) - { - return \Illuminate\Database\Query\Builder::hasMacro($name); + { + return \Illuminate\Database\Query\Builder::hasMacro($name); } /** @@ -13559,8 +17696,9 @@ public static function hasMacro($name) * @static */ public static function macroCall($method, $parameters) - { - return \Illuminate\Database\Query\Builder::macroCall($method, $parameters); + { + /** @var \Illuminate\Database\Query\Builder $instance */ + return $instance->macroCall($method, $parameters); } } @@ -13586,6 +17724,8 @@ class Queue extends \Illuminate\Support\Facades\Queue {} class Redirect extends \Illuminate\Support\Facades\Redirect {} + class Redis extends \Illuminate\Support\Facades\Redis {} + class Request extends \Illuminate\Support\Facades\Request {} class Response extends \Illuminate\Support\Facades\Response {} @@ -13603,6 +17743,18 @@ class URL extends \Illuminate\Support\Facades\URL {} class Validator extends \Illuminate\Support\Facades\Validator {} class View extends \Illuminate\Support\Facades\View {} + + class Captcha extends \Mews\Captcha\Facades\Captcha {} + + class Agent extends \Jenssegers\Agent\Facades\Agent {} + + class Purifier extends \Mews\Purifier\Facades\Purifier {} + + class Geetest extends \Misechow\Geetest\Geetest {} + + class NoCaptcha extends \Misechow\NoCaptcha\Facades\NoCaptcha {} + + class Image extends \Intervention\Image\Facades\Image {} } diff --git a/app/Components/AlipayNotify.php b/app/Components/AlipayNotify.php new file mode 100644 index 000000000..b4fcc7bb7 --- /dev/null +++ b/app/Components/AlipayNotify.php @@ -0,0 +1,249 @@ +sign_type = $sign_type; + $this->partner = $partner; + $this->md5_key = $md5_key; + $this->private_key = $private_key; + $this->alipay_public_key = $alipay_public_key; + $this->transport = $transport; + } + + /** + * 针对notify_url验证消息是否是支付宝发出的合法消息 + * + * @return bool 验证结果 + */ + public function verifyNotify() + { + if (empty($_POST)) { + return false; + } else { + // 生成签名结果 + $isSign = $this->getSignVeryfy($_POST, $_POST["sign"]); + + $converted_res = ($isSign) ? 'true' : 'false'; + + // 获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息) + $responseTxt = 'false'; + if (!empty($_POST["notify_id"])) { + $responseTxt = $this->getResponse($_POST["notify_id"]); + } + + // 验证 + // $responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关 + // isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关 + if (preg_match("/true$/i", $responseTxt) && $isSign) { + return true; + } else { + return false; + } + } + } + + /** + * 获取返回时的签名验证结果 + * + * @param array $para_temp 通知返回来的参数数组 + * @param string $sign 返回的签名结果 + * + * @return bool 签名验证结果 + */ + function getSignVeryfy($para_temp, $sign) + { + // 除去待签名参数数组中的空值和签名参数 + $para_filter = $this->paraFilter($para_temp); + + // 对待签名参数数组排序 + $para_sort = $this->argSort($para_filter); + + // 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 + $prestr = $this->createLinkString($para_sort); + + switch (strtoupper(trim($this->sign_type))) { + case "RSA" : + $isSgin = $this->rsaVerify($prestr, trim($this->alipay_public_key), $sign); + break; + case "MD5" : + $isSgin = $this->md5Verify($prestr, $sign, trim($this->md5_key)); + break; + default : + $isSgin = false; + } + + return $isSgin; + } + + /** + * 获取远程服务器ATN结果,验证返回URL + * + * @param integer $notify_id 通知校验ID + * + * @return string 服务器ATN结果 + * 验证结果集: + * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空 + * true 返回正确信息 + * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟 + */ + function getResponse($notify_id) + { + $transport = strtolower(trim($this->transport)); + $partner = trim($this->partner); + + $verify_url = $transport == 'https' ? $this->https_verify_url : $this->http_verify_url; + $verify_url = $verify_url . "partner=" . $partner . "¬ify_id=" . $notify_id; + $responseTxt = $this->getHttpResponseGET($verify_url, base_path('ca/cacert_alipay.pem')); + + return $responseTxt; + } + + /** + * RSA验签 + * + * @param string $data 待签名数据 + * @param string $alipay_public_key 支付宝的公钥字符串 + * @param string $sign 要校对的的签名结果 + * + * @return bool + */ + function rsaVerify($data, $alipay_public_key, $sign) + { + // 以下为了初始化私钥,保证在您填写私钥时不管是带格式还是不带格式都可以通过验证。 + $alipay_public_key = str_replace("-----BEGIN PUBLIC KEY-----", "", $alipay_public_key); + $alipay_public_key = str_replace("-----END PUBLIC KEY-----", "", $alipay_public_key); + $alipay_public_key = str_replace("\n", "", $alipay_public_key); + + $alipay_public_key = '-----BEGIN PUBLIC KEY-----' . PHP_EOL . wordwrap($alipay_public_key, 64, "\n", true) . PHP_EOL . '-----END PUBLIC KEY-----'; + $res = openssl_get_publickey($alipay_public_key); + if (!$res) { + \Log::error("支付宝公钥格式不正确"); + exit(); + } + + $result = (bool)openssl_verify($data, base64_decode($sign), $res); + openssl_free_key($res); + + return $result; + } + + /** + * 验证签名 + * + * @param string $prestr 需要签名的字符串pre-sign + * @param string $sign 签名结果 + * @param string $key 私钥 + * + * @return bool + */ + function md5Verify($prestr, $sign, $key) + { + $mysgin = md5($prestr . $key); + + return $mysgin == $sign ? true : false; + } + + /** + * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 + * + * @param array $para 需要拼接的数组 + * + * @return string + */ + function createLinkString($para) + { + $arg = ""; + while (list ($key, $val) = each($para)) { + $arg .= $key . "=" . $val . "&"; + } + + // 去掉最后一个&字符 + $arg = substr($arg, 0, count($arg) - 2); + + // 如果存在转义字符,那么去掉转义 + if (get_magic_quotes_gpc()) { + $arg = stripslashes($arg); + } + + return $arg; + } + + /** + * 远程获取数据,GET模式 + * 注意:文件夹中cacert.pem是SSL证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem' + * + * @param string $url 指定URL完整路径地址 + * @param string $cacert_url 指定当前工作目录绝对路径 + * + * @return mixed + */ + function getHttpResponseGET($url, $cacert_url) + { + $curl = curl_init($url); + curl_setopt($curl, CURLOPT_HEADER, 0); // 过滤HTTP头 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 显示输出结果 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); // SSL证书认证 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 严格认证 + curl_setopt($curl, CURLOPT_CAINFO, $cacert_url); // 证书地址 + $responseText = curl_exec($curl); + //var_dump( curl_error($curl) );//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容 + curl_close($curl); + + return $responseText; + } + + /** + * 除去数组中的空值和签名参数 + * + * @param array $para 签名参数组 + * + * @return array 去掉空值与签名参数后的新签名参数组 + */ + function paraFilter($para) + { + $para_filter = []; + while (list ($key, $val) = each($para)) { + if ($key == "sign" || $key == "sign_type" || $val == "") continue; + else $para_filter[$key] = $para[$key]; + } + + return $para_filter; + } + + /** + * 对数组排序 + * + * @param array $para 排序前的数组 + * + * @return array 排序后的数组 + */ + function argSort($para) + { + ksort($para); + reset($para); + + return $para; + } +} + +?> diff --git a/app/Components/AlipaySubmit.php b/app/Components/AlipaySubmit.php new file mode 100644 index 000000000..33df583c2 --- /dev/null +++ b/app/Components/AlipaySubmit.php @@ -0,0 +1,267 @@ +sign_type = $sign_type; + $this->partner = $partner; + $this->md5_key = $md5_key; + $this->private_key = $private_key; + } + + /** + * 生成签名结果 + * + * @param array $para_sort 已排序要签名的数组 + * + * @return string + */ + function buildRequestMysign($para_sort) + { + // 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 + $prestr = $this->createLinkString($para_sort); + + switch (strtoupper(trim($this->sign_type))) { + case "MD5" : + $mysign = $this->md5Sign($prestr, $this->md5_key); + break; + case "RSA" : + $mysign = $this->rsaSign($prestr, $this->private_key); + break; + default : + $mysign = ""; + } + + return $mysign; + } + + /** + * 生成要请求给支付宝的参数数组 + * + * @param array $para_temp 请求前的参数数组 + * + * @return array + */ + function buildRequestPara($para_temp) + { + // 除去待签名参数数组中的空值和签名参数 + $para_filter = $this->paraFilter($para_temp); + + // 对待签名参数数组排序 + $para_sort = $this->argSort($para_filter); + + // 生成签名结果 + $mysign = $this->buildRequestMysign($para_sort); + + // 签名结果与签名方式加入请求提交参数组中 + $para_sort['sign'] = $mysign; + $para_sort['sign_type'] = strtoupper(trim($this->sign_type)); + + return $para_sort; + } + + /** + * 生成要请求给支付宝的参数数组 + * + * @param array $para_temp 请求前的参数数组 + * + * @return string + */ + function buildRequestParaToString($para_temp) + { + // 待请求参数数组 + $para = $this->buildRequestPara($para_temp); + + // 把参数组中所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码 + $request_data = $this->createLinkStringUrlEncode($para); + + return $request_data; + } + + /** + * 建立请求,以表单HTML形式构造(默认) + * + * @param array $para_temp 请求参数数组 + * @param string $method 提交方式。两个值可选:post、get + * @param string $button_name 确认按钮显示文字 + * + * @return string + */ + public function buildRequestForm($para_temp, $method, $button_name) + { + // 待请求参数数组 + $para = $this->buildRequestPara($para_temp); + + $sHtml = "
"; + $sHtml = $sHtml . ""; + + return $sHtml; + } + + /** + * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 + * + * @return string + */ + function query_timestamp() + { + $url = $this->alipay_gateway_new . "service=query_timestamp&partner=" . trim(strtolower($this->partner)) . "&_input_charset=utf-8"; + + $doc = new DOMDocument(); + $doc->load($url); + $itemEncrypt_key = $doc->getElementsByTagName("encrypt_key"); + $encrypt_key = $itemEncrypt_key->item(0)->nodeValue; + + return $encrypt_key; + } + + /** + * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 + * + * @param array $para + * + * @return bool|string + */ + function createLinkString($para) + { + $arg = ""; + while (list ($key, $val) = each($para)) { + $arg .= $key . "=" . $val . "&"; + } + + // 去掉最后一个&字符 + $arg = substr($arg, 0, count($arg) - 2); + + // 如果存在转义字符,那么去掉转义 + if (get_magic_quotes_gpc()) { + $arg = stripslashes($arg); + } + + return $arg; + } + + /** + * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码 + * + * @param array $para 需要拼接的数组 + * + * @return bool|string + */ + function createLinkStringUrlEncode($para) + { + $arg = ""; + while (list ($key, $val) = each($para)) { + $arg .= $key . "=" . urlencode($val) . "&"; + } + + // 去掉最后一个&字符 + $arg = substr($arg, 0, count($arg) - 2); + + // 如果存在转义字符,那么去掉转义 + if (get_magic_quotes_gpc()) { + $arg = stripslashes($arg); + } + + return $arg; + } + + /** + * RSA签名 + * + * @param string $data 待签名数据 + * @param string $private_key 商户私钥字符串 + * + * @return string + */ + function rsaSign($data, $private_key) + { + //以下为了初始化私钥,保证在您填写私钥时不管是带格式还是不带格式都可以通过验证。 + $private_key = str_replace("-----BEGIN RSA PRIVATE KEY-----", "", $private_key); + $private_key = str_replace("-----END RSA PRIVATE KEY-----", "", $private_key); + $private_key = str_replace("\n", "", $private_key); + $private_key = "-----BEGIN RSA PRIVATE KEY-----" . PHP_EOL . wordwrap($private_key, 64, "\n", true) . PHP_EOL . "-----END RSA PRIVATE KEY-----"; + + $res = openssl_get_privatekey($private_key); + if (!$res) { + \Log::error("私钥格式不正确"); + exit(); + } + + openssl_sign($data, $sign, $res); + openssl_free_key($res); + + $sign = base64_encode($sign); // base64编码 + + return $sign; + } + + /** + * 签名字符串 + * + * @param string $prestr 需要签名的字符串 + * @param string $key 私钥 + * + * @return string + */ + function md5Sign($prestr, $key) + { + return md5($prestr . $key); + } + + /** + * 除去数组中的空值和签名参数 + * + * @param array $para 签名参数组 + * + * @return array + */ + function paraFilter($para) + { + $para_filter = []; + while (list ($key, $val) = each($para)) { + if ($key == "sign" || $key == "sign_type" || $val == "") continue; + else $para_filter[$key] = $para[$key]; + } + + return $para_filter; + } + + /** + * 对数组排序 + * + * @param array $para 排序前的数组 + * + * @return mixed + */ + function argSort($para) + { + ksort($para); + reset($para); + + return $para; + } +} \ No newline at end of file diff --git a/app/Components/CaptchaVerify.php b/app/Components/CaptchaVerify.php new file mode 100644 index 000000000..964814ba7 --- /dev/null +++ b/app/Components/CaptchaVerify.php @@ -0,0 +1,36 @@ + Helpers::systemConfig()["geetest_id"], + "geetest_key" => Helpers::systemConfig()["geetest_key"] + ]; + } + + /** + * 从后台获取 google_captcha_sitekey 和 google_captcha_secret + */ + public static function googleCaptchaGetConfig() + { + return [ + "sitekey" => Helpers::systemConfig()["google_captcha_sitekey"], + "secret" => Helpers::systemConfig()["google_captcha_secret"], + "options" => [] + ]; + } +} + +?> \ No newline at end of file diff --git a/app/Components/Curl.php b/app/Components/Curl.php new file mode 100644 index 000000000..ea69050df --- /dev/null +++ b/app/Components/Curl.php @@ -0,0 +1,32 @@ +get(); + $data = []; + foreach ($config as $vo) { + $data[$vo->name] = $vo->value; + } + + return $data; + } + + // 获取默认加密方式 + public static function getDefaultMethod() + { + $config = SsConfig::default()->type(1)->first(); + + return $config ? $config->name : 'aes-256-cfb'; + } + + // 获取默认协议 + public static function getDefaultProtocol() + { + $config = SsConfig::default()->type(2)->first(); + + return $config ? $config->name : 'origin'; + } + + // 获取默认混淆 + public static function getDefaultObfs() + { + $config = SsConfig::default()->type(3)->first(); + + return $config ? $config->name : 'plain'; + } + + // 获取一个随机端口 + public static function getRandPort() + { + $config = self::systemConfig(); + $port = mt_rand($config['min_port'], $config['max_port']); + + $exists_port = User::query()->pluck('port')->toArray(); + if (in_array($port, $exists_port) || in_array($port, self::$denyPorts)) { + $port = self::getRandPort(); + } + + return $port; + } + + // 获取一个端口 + public static function getOnlyPort() + { + $config = self::systemConfig(); + $port = $config['min_port']; + + $exists_port = User::query()->where('port', '>=', $config['min_port'])->pluck('port')->toArray(); + while (in_array($port, $exists_port) || in_array($port, self::$denyPorts)) { + $port = $port + 1; + } + + return $port; + } + + // 加密方式 + public static function methodList() + { + return SsConfig::type(1)->get(); + } + + // 协议 + public static function protocolList() + { + return SsConfig::type(2)->get(); + } + + // 混淆 + public static function obfsList() + { + return SsConfig::type(3)->get(); + } + + // 等级 + public static function levelList() + { + return Level::query()->get()->sortBy('level'); + } + + // 生成用户的订阅码 + public static function makeSubscribeCode() + { + $code = makeRandStr(5); + if (UserSubscribe::query()->where('code', $code)->exists()) { + $code = self::makeSubscribeCode(); + } + + return $code; + } + + /** + * 添加邮件投递日志 + * + * @param string $address 收信地址 + * @param string $title 标题 + * @param string $content 内容 + * @param int $status 投递状态 + * @param string $error 投递失败时记录的异常信息 + * + * @return int + */ + public static function addEmailLog($address, $title, $content, $status = 1, $error = '') + { + $log = new EmailLog(); + $log->type = 1; + $log->address = $address; + $log->title = $title; + $log->content = $content; + $log->status = $status; + $log->error = $error; + $log->save(); + + return $log->id; + } + + /** + * 添加优惠券操作日志 + * + * @param int $couponId 优惠券ID + * @param int $goodsId 商品ID + * @param int $orderId 订单ID + * @param string $desc 备注 + * + * @return int + */ + public static function addCouponLog($couponId, $goodsId, $orderId, $desc = '') + { + $log = new CouponLog(); + $log->coupon_id = $couponId; + $log->goods_id = $goodsId; + $log->order_id = $orderId; + $log->desc = $desc; + + return $log->save(); + } + + /** + * 记录流量变动日志 + * + * @param int $userId 用户ID + * @param string $oid 订单ID + * @param int $before 记录前的值 + * @param int $after 记录后的值 + * @param string $desc 描述 + * + * @return int + */ + public static function addUserTrafficModifyLog($userId, $oid, $before, $after, $desc = '') + { + $log = new UserTrafficModifyLog(); + $log->user_id = $userId; + $log->order_id = $oid; + $log->before = $before; + $log->after = $after; + $log->desc = $desc; + + return $log->save(); + } +} \ No newline at end of file diff --git a/app/Components/IPIP.php b/app/Components/IPIP.php new file mode 100644 index 000000000..8e15fe41c --- /dev/null +++ b/app/Components/IPIP.php @@ -0,0 +1,25 @@ +findMap($ip, 'CN'); + + return $result; + } +} \ No newline at end of file diff --git a/app/Components/Namesilo.php b/app/Components/Namesilo.php new file mode 100644 index 000000000..0cf43a90e --- /dev/null +++ b/app/Components/Namesilo.php @@ -0,0 +1,105 @@ +send('listDomains'); + } + + // 列出指定域名的所有DNS记录 + public function dnsListRecords($domain) + { + $query = [ + 'domain' => $domain + ]; + + return $this->send('dnsListRecords', $query); + } + + // 为指定域名添加DNS记录 + public function dnsAddRecord($domain, $host, $value, $type = 'A', $ttl = 7207) + { + $query = [ + 'domain' => $domain, + 'rrtype' => $type, + 'rrhost' => $host, + 'rrvalue' => $value, + 'rrttl' => $ttl + ]; + + return $this->send('dnsAddRecord', $query); + } + + // 更新DNS记录 + public function dnsUpdateRecord($domain, $id, $host, $value, $ttl = 7207) + { + $query = [ + 'domain' => $domain, + 'rrid' => $id, + 'rrhost' => $host, + 'rrvalue' => $value, + 'rrttl' => $ttl + ]; + + return $this->send('dnsUpdateRecord', $query); + } + + // 删除DNS记录 + public function dnsDeleteRecord($domain, $id) + { + $data = [ + 'domain' => $domain, + 'rrid' => $id + ]; + + return $this->send('dnsDeleteRecord', $data); + } + + // 发送请求 + private function send($operation, $data = []) + { + $params = [ + 'version' => 1, + 'type' => 'xml', + 'key' => self::$systemConfig['namesilo_key'] + ]; + $query = array_merge($params, $data); + + $content = '请求操作:[' . $operation . '] --- 请求数据:[' . http_build_query($query) . ']'; + + try { + $result = Curl::send(self::$host . $operation . '?' . http_build_query($query)); + $result = XML2Array::createArray($result); + + // 出错 + if (empty($result['namesilo']) || $result['namesilo']['reply']['code'] != 300 || $result['namesilo']['reply']['detail'] != 'success') { + Helpers::addEmailLog(self::$systemConfig['crash_warning_email'], '[Namesilo API] - [' . $operation . ']', $content, 0, $result['namesilo']['reply']['detail']); + } else { + Helpers::addEmailLog(self::$systemConfig['crash_warning_email'], '[Namesilo API] - [' . $operation . ']', $content, 1, $result['namesilo']['reply']['detail']); + } + + return $result['namesilo']['reply']; + } catch (\Exception $e) { + Log::error('CURL请求失败:' . $e->getMessage() . ' --- ' . $e->getLine()); + Helpers::addEmailLog(self::$systemConfig['crash_warning_email'], '[Namesilo API] - [' . $operation . ']', $content, 0, $e->getMessage()); + + return false; + } + } +} \ No newline at end of file diff --git a/app/Components/QQWry.php b/app/Components/QQWry.php new file mode 100644 index 000000000..0b004e67d --- /dev/null +++ b/app/Components/QQWry.php @@ -0,0 +1,22 @@ +errno) { + self::addLog($title, $content); + } else { + self::addLog($title, $content, 0, $result->errmsg); + } + } catch (\Exception $e) { + Log::error($e); + } + } + } + + /** + * 添加serverChan投递日志 + * + * @param string $title 标题 + * @param string $content 内容 + * @param int $status 投递状态 + * @param string $error 投递失败时记录的异常信息 + * + * @return int + */ + private static function addLog($title, $content, $status = 1, $error = '') + { + $log = new EmailLog(); + $log->type = 2; + $log->address = 'admin'; + $log->title = $title; + $log->content = $content; + $log->status = $status; + $log->error = $error; + + return $log->save(); + } +} \ No newline at end of file diff --git a/app/Components/Yzy.php b/app/Components/Yzy.php new file mode 100644 index 000000000..2e7a01299 --- /dev/null +++ b/app/Components/Yzy.php @@ -0,0 +1,73 @@ +getAccessToken(); + } + + // 获取accessToken + public function getAccessToken() + { + if (Cache::has('YZY_TOKEN')) { + $token = Cache::get('YZY_TOKEN'); + if (!isset($token['error'])) { + return Cache::get('YZY_TOKEN')['access_token']; + } + + Cache::forget('YZY_TOKEN'); + } + + $token = (new \Youzan\Open\Token(self::$systemConfig['youzan_client_id'], self::$systemConfig['youzan_client_secret']))->getToken('self', ['kdt_id' => self::$systemConfig['kdt_id']]); + if (isset($token['error'])) { + Log::info('获取有赞云支付access_token失败:' . $token['error_description']); + + return ''; + } else { + Cache::put('YZY_TOKEN', $token, 180); + + return $token['access_token']; + } + } + + // 生成收款二维码 + public function createQrCode($goodsName, $price, $orderSn) + { + $client = new \Youzan\Open\Client(self::$accessToken); + + $params = [ + 'qr_name' => $goodsName, // 商品名 + 'qr_price' => $price, // 单位分 + 'qr_source' => $orderSn, // 本地订单号 + 'qr_type' => 'QR_TYPE_DYNAMIC' + ]; + + return $client->get('youzan.pay.qrcode.create', '3.0.0', $params); + } + + // 通过tid获取交易信息 + public function getTradeByTid($tid) + { + $client = new \Youzan\Open\Client(self::$accessToken); + + return $client->post('youzan.trade.get', '4.0.0', ['tid' => $tid]); + } + + // 通过二维码ID获取已支付的交易信息 + public function getTradeByQrId($qr_id) + { + $client = new \Youzan\Open\Client(self::$accessToken); + + return $client->post('youzan.trades.qr.get', '3.0.0', ['qr_id' => $qr_id, 'status' => 'TRADE_RECEIVED']); + } +} \ No newline at end of file diff --git a/app/Console/Commands/AutoCheckNodeTCP.php b/app/Console/Commands/AutoCheckNodeTCP.php new file mode 100644 index 000000000..41f7f07b9 --- /dev/null +++ b/app/Console/Commands/AutoCheckNodeTCP.php @@ -0,0 +1,209 @@ +checkNodes(); + } elseif (Cache::get('tcp_check_time') <= time()) { + $this->checkNodes(); + } else { + Log::info('下次节点TCP阻断检测时间:' . date('Y-m-d H:i:s', Cache::get('tcp_check_time'))); + } + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 监测节点状态 + private function checkNodes() + { + $title = "节点异常警告"; + + $nodeList = SsNode::query()->where('is_transit', 0)->where('is_nat', 0)->where('status', 1)->where('is_tcp_check', 1)->get(); + foreach ($nodeList as $node) { + $tcpCheck = $this->tcpCheck($node->ip); + if (false !== $tcpCheck) { + switch ($tcpCheck) { + case 1: + $text = '服务器宕机'; + break; + case 2: + $text = '海外不通'; + break; + case 3: + $text = 'TCP阻断'; + break; + case 0: + default: + $text = '正常'; + } + + // 异常才发通知消息 + if ($tcpCheck) { + if (self::$systemConfig['tcp_check_warning_times']) { + // 已通知次数 + $cacheKey = 'tcp_check_warning_times_' . $node->id; + if (Cache::has($cacheKey)) { + $times = Cache::get($cacheKey); + } else { + Cache::put($cacheKey, 1, 725); // 最多设置提醒12次,12*60=720分钟缓存时效,多5分钟防止异常 + $times = 1; + } + + if ($times < self::$systemConfig['tcp_check_warning_times']) { + Cache::increment($cacheKey); + + $this->notifyMaster($title, "节点**{$node->name}【{$node->ip}】**:**" . $text . "**", $node->name, $node->server); + } elseif ($times >= self::$systemConfig['tcp_check_warning_times']) { + Cache::forget($cacheKey); + SsNode::query()->where('id', $node->id)->update(['status' => 0]); + + $this->notifyMaster($title, "节点**{$node->name}【{$node->ip}】**:**" . $text . "**,节点自动进入维护状态", $node->name, $node->server); + } + } else { + $this->notifyMaster($title, "节点**{$node->name}【{$node->ip}】**:**" . $text . "**", $node->name, $node->server); + } + } + + Log::info("【TCP阻断检测】" . $node->name . ' - ' . $node->ip . ' - ' . $text); + } + } + + // 随机生成下次检测时间 + $nextCheckTime = time() + mt_rand(1800, 3600); + Cache::put('tcp_check_time', $nextCheckTime, 60); + } + + /** + * 用ipcheck.need.sh进行TCP阻断检测 + * + * @param string $ip 被检测的IP + * + * @return bool|int + */ + private function tcpCheck($ip) + { + try { + $url = 'https://ipcheck.need.sh/api_v2.php?ip=' . $ip; + $ret = $this->curlRequest($url); + $ret = json_decode($ret); + if (!$ret || $ret->result != 'success') { + Log::warning("【TCP阻断检测】检测" . $ip . "时,接口返回异常"); + + return false; + } + } catch (\Exception $e) { + Log::warning("【TCP阻断检测】检测" . $ip . "时,接口请求超时"); + + return false; + } + + if (!$ret->data->inside_gfw->tcp->alive && !$ret->data->outside_gfw->tcp->alive) { + return 1; // 服务器宕机或者检测接口挂了 + } elseif ($ret->data->inside_gfw->tcp->alive && !$ret->data->outside_gfw->tcp->alive) { + return 2; // 国外访问异常 + } elseif (!$ret->data->inside_gfw->tcp->alive && $ret->data->outside_gfw->tcp->alive) { + return 3; // 被墙 + } else { + return 0; // 正常 + } + } + + /** + * 通知管理员 + * + * @param string $title 消息标题 + * @param string $content 消息内容 + * @param string $nodeName 节点名称 + * @param string $nodeServer 节点域名 + * + * @throws \GuzzleHttp\Exception\GuzzleException + */ + private function notifyMaster($title, $content, $nodeName, $nodeServer) + { + $this->notifyMasterByEmail($title, $content, $nodeName, $nodeServer); + ServerChan::send($title, $content); + } + + /** + * 发邮件通知管理员 + * + * @param string $title 消息标题 + * @param string $content 消息内容 + * @param string $nodeName 节点名称 + * @param string $nodeServer 节点域名 + */ + private function notifyMasterByEmail($title, $content, $nodeName, $nodeServer) + { + if (self::$systemConfig['crash_warning_email']) { + $logId = Helpers::addEmailLog(self::$systemConfig['crash_warning_email'], $title, $content); + Mail::to(self::$systemConfig['crash_warning_email'])->send(new nodeCrashWarning($logId, $nodeName, $nodeServer)); + } + } + + /** + * 发起一个CURL请求 + * + * @param string $url 请求地址 + * @param array $data POST数据,留空则为GET + * + * @return mixed + */ + private function curlRequest($url, $data = []) + { + $data = json_encode($data, JSON_UNESCAPED_UNICODE); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_URL, $url); +// curl_setopt($ch, CURLOPT_HTTPHEADER, [ +// 'Accept: application/json', // 请求报头 +// 'Content-Type: application/json', // 实体报头 +// 'Content-Length: ' . strlen($data) +// ]); + + // 如果data有数据,则用POST请求 + if ($data) { + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + } + + $result = curl_exec($ch); + curl_close($ch); + + return $result; + } +} diff --git a/app/Console/Commands/AutoClearLog.php b/app/Console/Commands/AutoClearLog.php new file mode 100644 index 000000000..ea8983423 --- /dev/null +++ b/app/Console/Commands/AutoClearLog.php @@ -0,0 +1,84 @@ +clearLog(); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 清除日志 + private function clearLog() + { + // 自动清除30分钟以前的节点负载信息日志 + SsNodeInfo::query()->where('log_time', '<=', strtotime("-30 minutes"))->delete(); + + // 自动清除1小时以前的节点在线用户数日志 + SsNodeOnlineLog::query()->where('log_time', '<=', strtotime("-1 hour"))->delete(); + + // 自动清除7天以前的用户流量日志 + UserTrafficLog::query()->where('log_time', '<=', strtotime("-7 days"))->delete(); + + // 自动清除10天以前的用户每小时流量数据日志 + UserTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-10 days')))->delete(); + + // 自动清除1个月以前的用户每天流量数据日志 + UserTrafficDaily::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-1 month')))->delete(); + + // 自动清除2个月以前的节点每小时流量数据日志 + SsNodeTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-2 month')))->delete(); + + // 自动清除3个月以前的节点每天流量数据日志 + SsNodeTrafficDaily::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 month')))->delete(); + + // 自动清除30天以前用户封禁日志 + UserBanLog::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-1 month")))->delete(); + + // 自动清除3天前用户连接IP + SsNodeIp::query()->where('created_at', '<=', strtotime("-3 days"))->delete(); + + // 自动清除3个月以前用户登陆日志 + UserLoginLog::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-3 month")))->delete(); + + // 自动清除1个月前的用户订阅记录 + UserSubscribeLog::query()->where('request_time', '<=', date('Y-m-d H:i:s', strtotime("-1 month")))->delete(); + } + +} diff --git a/app/Console/Commands/AutoDecGoodsTraffic.php b/app/Console/Commands/AutoDecGoodsTraffic.php new file mode 100644 index 000000000..edbfa6306 --- /dev/null +++ b/app/Console/Commands/AutoDecGoodsTraffic.php @@ -0,0 +1,125 @@ +decGoodsTraffic(); + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 扣减用户到期商品的流量 + private function decGoodsTraffic() + { + $orderList = Order::query()->with(['user', 'goods'])->where('status', 2)->where('is_expire', 0)->where('expire_at', '<', date('Y-m-d H:i:s'))->get(); + if (!$orderList->isEmpty()) { + // 用户默认标签 + $defaultLabels = []; + if (self::$systemConfig['initial_labels_for_user']) { + $defaultLabels = explode(',', self::$systemConfig['initial_labels_for_user']); + } + + DB::beginTransaction(); + try { + foreach ($orderList as $order) { + // 先过期本订单 + Order::query()->where('oid', $order->oid)->update(['is_expire' => 1]); + + // 再检查该订单对应用户是否还有套餐(非流量包)存在 + $haveOrder = Order::query() + ->with(['user', 'goods']) + ->where('is_expire', 0) + ->where('user_id', $order->user_id) + ->whereHas('goods', function ($q) { + $q->where('type', 2); + }) + ->orderBy('oid', 'desc') + ->first(); + if (!$haveOrder) { + // 如果不存在有效套餐(非流量包),则清空用户重置日 + User::query()->where('id', $order->user_id)->update(['traffic_reset_day' => 0]); + } + + if (empty($order->user) || empty($order->goods)) { + continue; + } + + if ($order->user->transfer_enable - $order->goods->traffic * 1048576 <= 0) { + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($order->user_id, $order->oid, $order->user->transfer_enable, 0, '[定时任务]用户所购商品到期,扣减商品对应的流量(扣完并重置)'); + + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0, 'transfer_enable' => 0]); + } else { + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($order->user_id, $order->oid, $order->user->transfer_enable, ($order->user->transfer_enable - $order->goods->traffic * 1048576), '[定时任务]用户所购商品到期,扣减商品对应的流量(没扣完)'); + + User::query()->where('id', $order->user_id)->decrement('transfer_enable', $order->goods->traffic * 1048576); + + // 处理已用流量 + if ($order->user->u + $order->user->d - $order->goods->traffic * 1048576 <= 0) { + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0]); + } else { + // 一般来说d的值远远大于u + if ($order->user->d - $order->goods->traffic * 1048576 >= 0) { + User::query()->where('id', $order->user_id)->decrement('d', $order->goods->traffic * 1048576); + } else { // 如果d不够减,则减u,然后d置0 + User::query()->where('id', $order->user_id)->decrement('u', $order->goods->traffic * 1048576 - $order->user->d); + User::query()->where('id', $order->user_id)->update(['d' => 0]); + } + } + } + + // 删除该商品对应用户的所有标签 + UserLabel::query()->where('user_id', $order->user->id)->delete(); + + // 取出用户的其他商品带有的标签 + $goodsIds = Order::query()->where('user_id', $order->user->id)->where('oid', '<>', $order->oid)->where('status', 2)->where('is_expire', 0)->groupBy('goods_id')->pluck('goods_id')->toArray(); + $goodsLabels = GoodsLabel::query()->whereIn('goods_id', $goodsIds)->groupBy('label_id')->pluck('label_id')->toArray(); + + // 生成标签 + $labels = array_values(array_unique(array_merge($goodsLabels, $defaultLabels))); // 标签去重 + foreach ($labels as $vo) { + $userLabel = new UserLabel(); + $userLabel->user_id = $order->user->id; + $userLabel->label_id = $vo; + $userLabel->save(); + } + } + + DB::commit(); + } catch (\Exception $e) { + \Log::error($this->description . ':' . $e); + + DB::rollBack(); + } + } + } +} diff --git a/app/Console/Commands/AutoJob.php b/app/Console/Commands/AutoJob.php new file mode 100644 index 000000000..7234be654 --- /dev/null +++ b/app/Console/Commands/AutoJob.php @@ -0,0 +1,618 @@ +expireVerifyCode(); + + // 优惠券到期自动置无效 + $this->expireCoupon(); + + // 邀请码到期自动置无效 + $this->expireInvite(); + + // 封禁访问异常的订阅链接 + $this->blockSubscribe(); + + // 封禁账号 + $this->blockUsers(); + + // 解封被封禁的账号 + $this->unblockUsers(); + + // 端口回收与分配 + $this->dispatchPort(); + + // 审计待支付的订单 + $this->detectOrders(); + + // 关闭超时未支付订单 + $this->closeOrders(); + + // 关闭超过72小时未处理的工单 + $this->closeTickets(); + + // 检测节点是否离线 + $this->checkNodeStatus(); + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 注册验证码自动置无效 + private function expireVerifyCode() + { + VerifyCode::query()->where('status', 0)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-10 minutes")))->update(['status' => 2]); + } + + // 优惠券到期自动置无效 + private function expireCoupon() + { + $couponList = Coupon::query()->where('status', 0)->where('available_end', '<=', time())->get(); + if (!$couponList->isEmpty()) { + foreach ($couponList as $coupon) { + Coupon::query()->where('id', $coupon->id)->update(['status' => 2]); + } + } + } + + // 邀请码到期自动置无效 + private function expireInvite() + { + $inviteList = Invite::query()->where('status', 0)->where('dateline', '<=', date('Y-m-d H:i:s'))->get(); + if (!$inviteList->isEmpty()) { + foreach ($inviteList as $invite) { + Invite::query()->where('id', $invite->id)->update(['status' => 2]); + } + } + } + + // 封禁访问异常的订阅链接 + private function blockSubscribe() + { + if (self::$systemConfig['is_subscribe_ban']) { + $subscribeList = UserSubscribe::query()->where('status', 1)->get(); + if (!$subscribeList->isEmpty()) { + foreach ($subscribeList as $subscribe) { + // 24小时内不同IP的请求次数 + $request_times = UserSubscribeLog::query()->where('sid', $subscribe->id)->where('request_time', '>=', date("Y-m-d H:i:s", strtotime("-24 hours")))->distinct('request_ip')->count('request_ip'); + if ($request_times >= self::$systemConfig['subscribe_ban_times']) { + UserSubscribe::query()->where('id', $subscribe->id)->update(['status' => 0, 'ban_time' => time(), 'ban_desc' => '存在异常,自动封禁']); + + // 记录封禁日志 + $this->addUserBanLog($subscribe->user_id, 0, '【完全封禁订阅】-订阅24小时内请求异常'); + } + } + } + } + } + + // 封禁账号 + private function blockUsers() + { + // 过期用户处理 + $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->where('expire_time', '<', date('Y-m-d'))->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + if (self::$systemConfig['is_ban_status']) { + User::query()->where('id', $user->id)->update([ + 'u' => 0, + 'd' => 0, + 'transfer_enable' => 0, + 'enable' => 0, + 'traffic_reset_day' => 0, + 'ban_time' => 0, + 'status' => -1 + ]); + + $this->addUserBanLog($user->id, 0, '【禁止登录,清空账户】-账号已过期'); + + // 如果注册就有初始流量,则废除其名下邀请码 + if (self::$systemConfig['default_traffic']) { + Invite::query()->where('uid', $user->id)->where('status', 0)->update(['status' => 2]); + } + + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($user->id, 0, $user->transfer_enable, 0, '[定时任务]账号已过期(禁止登录,清空账户)'); + } else { + User::query()->where('id', $user->id)->update([ + 'u' => 0, + 'd' => 0, + 'transfer_enable' => 0, + 'enable' => 0, + 'traffic_reset_day' => 0, + 'ban_time' => 0 + ]); + + $this->addUserBanLog($user->id, 0, '【封禁代理,清空账户】-账号已过期'); + + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($user->id, 0, $user->transfer_enable, 0, '[定时任务]账号已过期(封禁代理,清空账户)'); + } + + // 移除标签 + UserLabel::query()->where('user_id', $user->id)->delete(); + } + } + + // 封禁1小时内流量异常账号 + if (self::$systemConfig['is_traffic_ban']) { + $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->where('ban_time', 0)->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + // 对管理员豁免 + if ($user->is_admin) { + continue; + } + + // 多往前取5分钟,防止数据统计任务执行时间过长导致没有数据 + $totalTraffic = UserTrafficHourly::query()->where('user_id', $user->id)->where('node_id', 0)->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))->sum('total'); + if ($totalTraffic >= (self::$systemConfig['traffic_ban_value'] * 1024 * 1024 * 1024)) { + User::query()->where('id', $user->id)->update(['enable' => 0, 'ban_time' => strtotime(date('Y-m-d H:i:s', strtotime("+" . self::$systemConfig['traffic_ban_time'] . " minutes")))]); + + // 写入日志 + $this->addUserBanLog($user->id, self::$systemConfig['traffic_ban_time'], '【临时封禁代理】-1小时内流量异常'); + } + } + } + } + + // 禁用流量超限用户 + $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->where('ban_time', 0)->whereRaw("u + d >= transfer_enable")->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + User::query()->where('id', $user->id)->update(['enable' => 0]); + + // 写入日志 + $this->addUserBanLog($user->id, 0, '【封禁代理】-流量已用完'); + } + } + } + + // 解封被临时封禁的账号 + private function unblockUsers() + { + // 解封被临时封禁的账号 + $userList = User::query()->where('status', '>=', 0)->where('enable', 0)->where('ban_time', '>', 0)->get(); + foreach ($userList as $user) { + if ($user->ban_time < time()) { + User::query()->where('id', $user->id)->update(['enable' => 1, 'ban_time' => 0]); + + // 写入操作日志 + $this->addUserBanLog($user->id, 0, '【自动解封】-临时封禁到期'); + } + } + + // 可用流量大于已用流量也解封(比如:邀请返利自动加了流量) + $userList = User::query()->where('status', '>=', 0)->where('enable', 0)->where('ban_time', 0)->where('expire_time', '>=', date('Y-m-d'))->whereRaw("u + d < transfer_enable")->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + User::query()->where('id', $user->id)->update(['enable' => 1]); + + // 写入操作日志 + $this->addUserBanLog($user->id, 0, '【自动解封】-有流量解封'); + } + } + } + + // 端口回收与分配 + private function dispatchPort() + { + if (self::$systemConfig['auto_release_port']) { + ## 自动分配端口 + $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->where('port', 0)->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + $port = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + + User::query()->where('id', $user->id)->update(['port' => $port]); + } + } + + ## 被封禁的账号自动释放端口 + $userList = User::query()->where('status', -1)->where('enable', 0)->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + if ($user->port) { + User::query()->where('id', $user->id)->update(['port' => 0]); + } + } + } + + ## 过期一个月的账户自动释放端口 + $userList = User::query()->where('enable', 0)->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + if ($user->port) { + $overdueDays = floor((strtotime(date('Y-m-d H:i:s')) - strtotime($user->expire_time)) / 86400); + if ($overdueDays > 30) { + User::query()->where('id', $user->id)->update(['port' => 0]); + } + } + } + } + } + } + + // 审计待支付的订单 + private function detectOrders() + { + /* + * 因为订单在15分钟未支付则会被自动关闭 + * 当有赞没有正常推送消息或者其他原因导致用户已付款但是订单不生效从而导致用户无法正常加流量、置状态 + * 故需要每分钟请求一次未支付订单,审计一下其支付状态 + */ + $paymentList = Payment::query()->with(['order', 'user'])->where('status', 0)->where('qr_id', '>', 0)->get(); + if (!$paymentList->isEmpty()) { + foreach ($paymentList as $payment) { + // 跳过order丢失的订单 + if (!isset($payment->order)) { + continue; + } + + $yzy = new yzy(); + $trade = $yzy->getTradeByQrId($payment->qr_id); + if ($trade['response']['total_results']) { + // 再判断一遍当前要操作的订单的状态是否被改变了(可能请求延迟的时候已经回调处理完了) + $payment = Payment::query()->where('id', $payment->id)->first(); + if ($payment->status != '0') { + continue; + } + + // 处理订单 + DB::beginTransaction(); + try { + // 如果支付单中没有用户信息则创建一个用户 + if (!$payment->user_id) { + // 生成一个可用端口 + $port = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + + $user = new User(); + $user->username = '自动生成-' . $payment->order->email; + $user->password = md5(makeRandStr()); + $user->port = $port; + $user->passwd = makeRandStr(); + $user->vmess_id = createGuid(); + $user->enable = 1; + $user->method = Helpers::getDefaultMethod(); + $user->protocol = Helpers::getDefaultProtocol(); + $user->obfs = Helpers::getDefaultObfs(); + $user->usage = 1; + $user->transfer_enable = 1; // 新创建的账号给1,防止定时任务执行时发现u + d >= transfer_enable被判为流量超限而封禁 + $user->enable_time = date('Y-m-d'); + $user->expire_time = date('Y-m-d', strtotime("+" . $payment->order->goods->days . " days")); + $user->reg_ip = getClientIp(); + $user->referral_uid = 0; + $user->traffic_reset_day = 0; + $user->status = 1; + $user->save(); + + if ($user->id) { + Order::query()->where('oid', $payment->oid)->update(['user_id' => $user->id]); + } + } + + // 更新支付单 + $payment->pay_way = $trade['response']['pay_type'] == 'WXPAY_BIGUNSIGN' ? 1 : 2; // 1-微信、2-支付宝 + $payment->status = 1; + $payment->save(); + + // 更新订单 + $order = Order::query()->with(['user'])->where('oid', $payment->oid)->first(); + $order->status = 2; + $order->save(); + + $goods = Goods::query()->where('id', $order->goods_id)->first(); + + // 商品为流量或者套餐 + if ($goods->type <= 2) { + // 如果买的是套餐,则先将之前购买的所有套餐置都无效,并扣掉之前所有套餐的流量,重置用户已用流量为0 + if ($goods->type == 2) { + $existOrderList = Order::query() + ->with(['goods']) + ->whereHas('goods', function ($q) { + $q->where('type', 2); + }) + ->where('user_id', $order->user_id) + ->where('oid', '<>', $order->oid) + ->where('is_expire', 0) + ->where('status', 2) + ->get(); + + foreach ($existOrderList as $vo) { + Order::query()->where('oid', $vo->oid)->update(['is_expire' => 1]); + + // 先判断,防止手动扣减过流量的用户流量被扣成负数 + if ($order->user->transfer_enable - $vo->goods->traffic * 1048576 <= 0) { + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($order->user_id, 0, $order->user->transfer_enable, 0, '[定时任务]审计待支付的订单(扣完)'); + + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0, 'transfer_enable' => 0]); + } else { + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($order->user_id, 0, $order->user->transfer_enable, ($order->user->transfer_enable - $vo->goods->traffic * 1048576), '[定时任务]审计待支付的订单'); + + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0]); + User::query()->where('id', $order->user_id)->decrement('transfer_enable', $vo->goods->traffic * 1048576); + } + } + } + + // 计算账号过期时间 + if ($order->user->expire_time < date('Y-m-d', strtotime("+" . $goods->days . " days"))) { + $expireTime = date('Y-m-d', strtotime("+" . $goods->days . " days")); + } else { + $expireTime = $order->user->expire_time; + } + + // 把商品的流量加到账号上 + User::query()->where('id', $order->user_id)->increment('transfer_enable', $goods->traffic * 1048576); + + // 套餐就改流量重置日,流量包不改 + if ($goods->type == 2) { + if (date('m') == 2 && date('d') == 29) { + $traffic_reset_day = 28; + } else { + $traffic_reset_day = date('d') == 31 ? 30 : abs(date('d')); + } + + User::query()->where('id', $order->user_id)->update(['traffic_reset_day' => $traffic_reset_day, 'expire_time' => $expireTime, 'enable' => 1]); + } else { + User::query()->where('id', $order->user_id)->update(['expire_time' => $expireTime, 'enable' => 1]); + } + + // 写入用户标签 + if ($goods->label) { + // 用户默认标签 + $defaultLabels = []; + if (self::$systemConfig['initial_labels_for_user']) { + $defaultLabels = explode(',', self::$systemConfig['initial_labels_for_user']); + } + + // 取出现有的标签 + $userLabels = UserLabel::query()->where('user_id', $order->user_id)->pluck('label_id')->toArray(); + $goodsLabels = GoodsLabel::query()->where('goods_id', $order->goods_id)->pluck('label_id')->toArray(); + + // 标签去重 + $newUserLabels = array_values(array_unique(array_merge($userLabels, $goodsLabels, $defaultLabels))); + + // 删除用户所有标签 + UserLabel::query()->where('user_id', $order->user_id)->delete(); + + // 生成标签 + foreach ($newUserLabels as $vo) { + $obj = new UserLabel(); + $obj->user_id = $order->user_id; + $obj->label_id = $vo; + $obj->save(); + } + } + + // 写入返利日志 + if ($order->user->referral_uid) { + $this->addReferralLog($order->user_id, $order->user->referral_uid, $order->oid, $order->amount, $order->amount * self::$systemConfig['referral_percent']); + } + + // 取消重复返利 + User::query()->where('id', $order->user_id)->update(['referral_uid' => 0]); + + } elseif ($goods->type == 3) { // 商品为在线充值 + User::query()->where('id', $order->user_id)->increment('balance', $goods->price * 100); + + // 余额变动记录日志 + $this->addUserBalanceLog($order->user_id, $order->oid, $order->user->balance, $order->user->balance + $goods->price, $goods->price, '用户在线充值'); + } + + // 自动提号机:如果order的email值不为空 + if ($order->email) { + $title = '【' . self::$systemConfig['website_name'] . '】您的账号信息'; + $content = [ + 'order_sn' => $order->order_sn, + 'goods_name' => $order->goods->name, + 'goods_traffic' => flowAutoShow($order->goods->traffic * 1048576), + 'port' => $order->user->port, + 'passwd' => $order->user->passwd, + 'method' => $order->user->method, + //'protocol' => $order->user->protocol, + //'protocol_param' => $order->user->protocol_param, + //'obfs' => $order->user->obfs, + //'obfs_param' => $order->user->obfs_param, + 'created_at' => $order->created_at->toDateTimeString(), + 'expire_at' => $order->expire_at + ]; + + // 获取可用节点列表 + $labels = UserLabel::query()->where('user_id', $order->user_id)->get()->pluck('label_id'); + $nodeIds = SsNodeLabel::query()->whereIn('label_id', $labels)->get()->pluck('node_id'); + $nodeList = SsNode::query()->whereIn('id', $nodeIds)->orderBy('sort', 'desc')->orderBy('id', 'desc')->get()->toArray(); + $content['serverList'] = $nodeList; + + $logId = Helpers::addEmailLog($order->email, $title, json_encode($content)); + Mail::to($order->email)->send(new sendUserInfo($logId, $content)); + } + + DB::commit(); + } catch (\Exception $e) { + DB::rollBack(); + + Log::info('【有赞云】审计订单时更新支付单和订单异常:' . $e); + } + } + } + } + } + + // 关闭超时未支付订单 + private function closeOrders() + { + // 关闭超时未支付的有赞云订单(有赞云收款二维码超过30分钟自动关闭,关闭后无法再支付,所以我们限制15分钟内必须付款) + $paymentList = Payment::query()->with(['order', 'order.coupon'])->where('status', 0)->where('created_at', '<=', date("Y-m-d H:i:s", strtotime("-15 minutes")))->get(); + if (!$paymentList->isEmpty()) { + DB::beginTransaction(); + try { + foreach ($paymentList as $payment) { + // 关闭支付单 + Payment::query()->where('id', $payment->id)->update(['status' => -1]); + + // 关闭订单 + Order::query()->where('oid', $payment->oid)->update(['status' => -1]); + + // 退回优惠券 + if ($payment->order->coupon_id) { + Coupon::query()->where('id', $payment->order->coupon_id)->update(['status' => 0]); + + Helpers::addCouponLog($payment->order->coupon_id, $payment->order->goods_id, $payment->oid, '订单超时未支付,自动退回'); + } + } + + DB::commit(); + } catch (\Exception $e) { + Log::info('【异常】自动关闭超时未支付订单:' . $e); + + DB::rollBack(); + } + } + } + + // 关闭超过72小时未处理的工单 + private function closeTickets() + { + $ticketList = Ticket::query()->where('updated_at', '<=', date('Y-m-d H:i:s', strtotime("-72 hours")))->where('status', 1)->get(); + foreach ($ticketList as $ticket) { + $ret = Ticket::query()->where('id', $ticket->id)->update(['status' => 2]); + if ($ret) { + ServerChan::send('工单关闭提醒', '工单:ID' . $ticket->id . '超过72小时未处理,系统已自动关闭'); + } + } + } + + // 检测节点是否离线 + private function checkNodeStatus() + { + if (Helpers::systemConfig()['is_node_crash_warning']) { + $nodeList = SsNode::query()->where('is_transit', 0)->where('status', 1)->get(); + foreach ($nodeList as $node) { + // 10分钟内无节点负载信息且TCP检测认为不是离线则认为是后端炸了 + $nodeTTL = SsNodeInfo::query()->where('node_id', $node->id)->where('log_time', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->first(); + if (!$nodeTTL) { + ServerChan::send('节点异常警告', "节点**{$node->name}【{$node->ip}】**异常:**心跳异常,可能离线了**"); + } + } + } + } + + /** + * 添加用户封禁日志 + * + * @param int $userId 用户ID + * @param int $minutes 封禁时长,单位分钟 + * @param string $desc 封禁理由 + */ + private function addUserBanLog($userId, $minutes, $desc) + { + $log = new UserBanLog(); + $log->user_id = $userId; + $log->minutes = $minutes; + $log->desc = $desc; + $log->save(); + } + + /** + * 添加返利日志 + * + * @param int $userId 用户ID + * @param int $refUserId 返利用户ID + * @param int $oid 订单ID + * @param int $amount 发生金额 + * @param int $refAmount 返利金额 + * + * @return int + */ + public function addReferralLog($userId, $refUserId, $oid, $amount, $refAmount) + { + $log = new ReferralLog(); + $log->user_id = $userId; + $log->ref_user_id = $refUserId; + $log->order_id = $oid; + $log->amount = $amount; + $log->ref_amount = $refAmount; + $log->status = 0; + + return $log->save(); + } + + /** + * 记录余额操作日志 + * + * @param int $userId 用户ID + * @param string $oid 订单ID + * @param int $before 记录前余额 + * @param int $after 记录后余额 + * @param int $amount 发生金额 + * @param string $desc 描述 + * + * @return int + */ + public function addUserBalanceLog($userId, $oid, $before, $after, $amount, $desc = '') + { + $log = new UserBalanceLog(); + $log->user_id = $userId; + $log->order_id = $oid; + $log->before = $before; + $log->after = $after; + $log->amount = $amount; + $log->desc = $desc; + $log->created_at = date('Y-m-d H:i:s'); + + return $log->save(); + } +} diff --git a/app/Console/Commands/AutoReportNode.php b/app/Console/Commands/AutoReportNode.php new file mode 100644 index 000000000..88bb99186 --- /dev/null +++ b/app/Console/Commands/AutoReportNode.php @@ -0,0 +1,55 @@ +where('status', 1)->get(); + if (!$nodeList->isEmpty()) { + $msg = "|节点|上行流量|下行流量|合计|\r\n| :------ | :------ | :------ |\r\n"; + foreach ($nodeList as $node) { + $log = SsNodeTrafficDaily::query() + ->where('node_id', $node->id) + ->where('created_at', '>=', date('Y-m-d 00:00:00', strtotime("-1 day"))) + ->where('created_at', '<=', date('Y-m-d 23:59:59', strtotime("-1 day"))) + ->first(); + + if ($log) { + $msg .= '|' . $node->name . '|' . flowAutoShow($log->u) . '|' . flowAutoShow($log->d) . '|' . $log->traffic . "\r\n"; + } else { + $msg .= '|' . $node->name . '|' . flowAutoShow(0) . '|' . flowAutoShow(0) . "|0B\r\n"; + } + } + + ServerChan::send('节点日报', $msg); + } + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } +} diff --git a/app/Console/Commands/AutoResetUserTraffic.php b/app/Console/Commands/AutoResetUserTraffic.php new file mode 100644 index 000000000..3be751759 --- /dev/null +++ b/app/Console/Commands/AutoResetUserTraffic.php @@ -0,0 +1,78 @@ +resetUserTraffic(); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 重置用户流量 + private function resetUserTraffic() + { + $userList = User::query()->where('status', '>=', 0)->where('expire_time', '>=', date('Y-m-d'))->get(); + if (!$userList->isEmpty()) { + foreach ($userList as $user) { + if (!$user->traffic_reset_day) { + continue; + } + + // 取出用户最后购买的有效套餐 + $order = Order::query() + ->with(['user', 'goods']) + ->whereHas('goods', function ($q) { + $q->where('type', 2); + }) + ->where('user_id', $user->id) + ->where('is_expire', 0) + ->orderBy('oid', 'desc') + ->first(); + + if (!$order) { + continue; + } + + $month = abs(date('m')); + $today = abs(date('d')); + if ($order->user->traffic_reset_day == $today) { + // 跳过本月,防止异常重置 + if ($month == date('m', strtotime($order->expire_at))) { + continue; + } elseif ($month == date('m', strtotime($order->created_at))) { + continue; + } + + User::query()->where('id', $user->id)->update(['u' => 0, 'd' => 0]); + } + } + } + } +} diff --git a/app/Console/Commands/AutoStatisticsNodeDailyTraffic.php b/app/Console/Commands/AutoStatisticsNodeDailyTraffic.php new file mode 100644 index 000000000..b388b9772 --- /dev/null +++ b/app/Console/Commands/AutoStatisticsNodeDailyTraffic.php @@ -0,0 +1,58 @@ +where('status', 1)->orderBy('id', 'asc')->get(); + foreach ($nodeList as $node) { + $this->statisticsByNode($node->id); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + private function statisticsByNode($node_id) + { + $start_time = strtotime(date('Y-m-d 00:00:00', strtotime("-1 day"))); + $end_time = strtotime(date('Y-m-d 23:59:59', strtotime("-1 day"))); + + $query = UserTrafficLog::query()->where('node_id', $node_id)->whereBetween('log_time', [$start_time, $end_time]); + + $u = $query->sum('u'); + $d = $query->sum('d'); + $total = $u + $d; + $traffic = flowAutoShow($total); + + if ($total) { // 有数据才记录 + $obj = new SsNodeTrafficDaily(); + $obj->node_id = $node_id; + $obj->u = $u; + $obj->d = $d; + $obj->total = $total; + $obj->traffic = $traffic; + $obj->save(); + } + } +} diff --git a/app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php b/app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php new file mode 100644 index 000000000..97248f49c --- /dev/null +++ b/app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php @@ -0,0 +1,58 @@ +where('status', 1)->orderBy('id', 'asc')->get(); + foreach ($nodeList as $node) { + $this->statisticsByNode($node->id); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + private function statisticsByNode($node_id) + { + $start_time = strtotime(date('Y-m-d H:i:s', strtotime("-1 hour"))); + $end_time = time(); + + $query = UserTrafficLog::query()->where('node_id', $node_id)->whereBetween('log_time', [$start_time, $end_time]); + + $u = $query->sum('u'); + $d = $query->sum('d'); + $total = $u + $d; + $traffic = flowAutoShow($total); + + if ($total) { // 有数据才记录 + $obj = new SsNodeTrafficHourly(); + $obj->node_id = $node_id; + $obj->u = $u; + $obj->d = $d; + $obj->total = $total; + $obj->traffic = $traffic; + $obj->save(); + } + } +} diff --git a/app/Console/Commands/AutoStatisticsUserDailyTraffic.php b/app/Console/Commands/AutoStatisticsUserDailyTraffic.php new file mode 100644 index 000000000..b84ceba93 --- /dev/null +++ b/app/Console/Commands/AutoStatisticsUserDailyTraffic.php @@ -0,0 +1,71 @@ +where('status', '>=', 0)->where('enable', 1)->get(); + foreach ($userList as $user) { + // 统计一次所有节点的总和 + $this->statisticsByNode($user->id); + + // 统计每个节点产生的流量 + $nodeList = SsNode::query()->where('status', 1)->orderBy('id', 'asc')->get(); + foreach ($nodeList as $node) { + $this->statisticsByNode($user->id, $node->id); + } + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + private function statisticsByNode($user_id, $node_id = 0) + { + $start_time = strtotime(date('Y-m-d 00:00:00', strtotime("-1 day"))); + $end_time = strtotime(date('Y-m-d 23:59:59', strtotime("-1 day"))); + + $query = UserTrafficLog::query()->where('user_id', $user_id)->whereBetween('log_time', [$start_time, $end_time]); + + if ($node_id) { + $query->where('node_id', $node_id); + } + + $u = $query->sum('u'); + $d = $query->sum('d'); + $total = $u + $d; + $traffic = flowAutoShow($total); + + if ($total) { // 有数据才记录 + $obj = new UserTrafficDaily(); + $obj->user_id = $user_id; + $obj->node_id = $node_id; + $obj->u = $u; + $obj->d = $d; + $obj->total = $total; + $obj->traffic = $traffic; + $obj->save(); + } + } +} diff --git a/app/Console/Commands/AutoStatisticsUserHourlyTraffic.php b/app/Console/Commands/AutoStatisticsUserHourlyTraffic.php new file mode 100644 index 000000000..ada5afbc1 --- /dev/null +++ b/app/Console/Commands/AutoStatisticsUserHourlyTraffic.php @@ -0,0 +1,71 @@ +where('status', '>=', 0)->where('enable', 1)->get(); + foreach ($userList as $user) { + // 统计一次所有节点的总和 + $this->statisticsByNode($user->id); + + // 统计每个节点产生的流量 + $nodeList = SsNode::query()->where('status', 1)->orderBy('id', 'asc')->get(); + foreach ($nodeList as $node) { + $this->statisticsByNode($user->id, $node->id); + } + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + private function statisticsByNode($user_id, $node_id = 0) + { + $start_time = strtotime(date('Y-m-d H:i:s', strtotime("-1 hour"))); + $end_time = time(); + + $query = UserTrafficLog::query()->where('user_id', $user_id)->whereBetween('log_time', [$start_time, $end_time]); + + if ($node_id) { + $query->where('node_id', $node_id); + } + + $u = $query->sum('u'); + $d = $query->sum('d'); + $total = $u + $d; + $traffic = flowAutoShow($total); + + if ($total) { // 有数据才记录 + $obj = new UserTrafficHourly(); + $obj->user_id = $user_id; + $obj->node_id = $node_id; + $obj->u = $u; + $obj->d = $d; + $obj->total = $total; + $obj->traffic = $traffic; + $obj->save(); + } + } +} diff --git a/app/Console/Commands/UserExpireAutoWarning.php b/app/Console/Commands/UserExpireAutoWarning.php new file mode 100644 index 000000000..39b0eb8fc --- /dev/null +++ b/app/Console/Commands/UserExpireAutoWarning.php @@ -0,0 +1,67 @@ +userExpireWarning(); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + private function userExpireWarning() + { + // 只取SSR没被禁用的用户,其他不用管 + $userList = User::query()->where('enable', 1)->get(); + foreach ($userList as $user) { + // 用户名不是邮箱的跳过 + if (false === filter_var($user->username, FILTER_VALIDATE_EMAIL)) { + continue; + } + + // 计算剩余可用时间 + $lastCanUseDays = ceil(round(strtotime($user->expire_time) - strtotime(date('Y-m-d H:i:s'))) / 3600 / 24); + if ($lastCanUseDays == 0) { + $title = '账号过期提醒'; + $content = '您的账号将于今天晚上【24:00】过期。'; + + $logId = Helpers::addEmailLog($user->username, $title, $content); + Mail::to($user->username)->send(new userExpireWarningToday($logId)); + } elseif ($lastCanUseDays > 0 && $lastCanUseDays <= self::$systemConfig['expire_days']) { + $title = '账号过期提醒'; + $content = '您的账号还剩' . $lastCanUseDays . '天即将过期。'; + + $logId = Helpers::addEmailLog($user->username, $title, $content); + Mail::to($user->username)->send(new userExpireWarning($logId, $lastCanUseDays)); + } + } + } +} diff --git a/app/Console/Commands/UserTrafficAbnormalAutoWarning.php b/app/Console/Commands/UserTrafficAbnormalAutoWarning.php new file mode 100644 index 000000000..c3fdc6ee7 --- /dev/null +++ b/app/Console/Commands/UserTrafficAbnormalAutoWarning.php @@ -0,0 +1,59 @@ +userTrafficAbnormalWarning(); + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 用户流量异常警告 + private function userTrafficAbnormalWarning() + { + // 1小时内流量异常用户(多往前取5分钟,防止数据统计任务执行时间过长导致没有数据) + $userTotalTrafficList = UserTrafficHourly::query()->where('node_id', 0)->where('total', '>', 104857600)->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))->groupBy('user_id')->selectRaw("user_id, sum(total) as totalTraffic")->get(); // 只统计100M以上的记录,加快查询速度 + if (!$userTotalTrafficList->isEmpty()) { + $title = "流量异常用户提醒"; + + foreach ($userTotalTrafficList as $vo) { + $user = User::query()->where('id', $vo->user_id)->first(); + + // 通过ServerChan发微信消息提醒管理员 + if ($vo->totalTraffic > (self::$systemConfig['traffic_ban_value'] * 1024 * 1024 * 1024)) { + $traffic = UserTrafficHourly::query()->where('node_id', 0)->where('user_id', $vo->user_id)->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))->selectRaw("user_id, sum(`u`) as totalU, sum(`d`) as totalD, sum(total) as totalTraffic")->first(); + + $content = "用户**{$user->username}(ID:{$user->id})**,最近1小时**上行流量:" . flowAutoShow($traffic->totalU) . ",下行流量:" . flowAutoShow($traffic->totalD) . ",共计:" . flowAutoShow($traffic->totalTraffic) . "**。"; + + ServerChan::send($title, $content); + } + } + } + } +} diff --git a/app/Console/Commands/UserTrafficAutoWarning.php b/app/Console/Commands/UserTrafficAutoWarning.php new file mode 100644 index 000000000..3c11d4199 --- /dev/null +++ b/app/Console/Commands/UserTrafficAutoWarning.php @@ -0,0 +1,59 @@ +userTrafficWarning(); + } + + $jobEndTime = microtime(true); + $jobUsedTime = round(($jobEndTime - $jobStartTime), 4); + + Log::info('执行定时任务【' . $this->description . '】,耗时' . $jobUsedTime . '秒'); + } + + // 用户流量超过警告阈值自动发邮件提醒 + private function userTrafficWarning() + { + $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->where('transfer_enable', '>', 0)->get(); + foreach ($userList as $user) { + // 用户名不是邮箱的跳过 + if (false === filter_var($user->username, FILTER_VALIDATE_EMAIL)) { + continue; + } + + $usedPercent = round(($user->d + $user->u) / $user->transfer_enable, 2) * 100; // 已使用流量百分比 + if ($usedPercent >= self::$systemConfig['traffic_warning_percent']) { + $title = '流量提醒'; + $content = '流量已使用:' . $usedPercent . '%,请保持关注。'; + + $logId = Helpers::addEmailLog($user->username, $title, $content); + Mail::to($user->username)->send(new userTrafficWarning($logId, $usedPercent)); + } + } + } +} diff --git a/app/Console/Commands/upgradeUserLabels.php b/app/Console/Commands/upgradeUserLabels.php new file mode 100644 index 000000000..354c3e80c --- /dev/null +++ b/app/Console/Commands/upgradeUserLabels.php @@ -0,0 +1,54 @@ +where('status', '>=', 0)->get(); + foreach ($userList as $user) { + // 跳过已经有标签的用户 + $count = UserLabel::query()->where('user_id', $user->id)->count(); + if ($count) { + continue; + } + + // 给用户生成默认标签 + $this->makeUserDefaultLabels($user->id); + } + } + + // 生成用户默认标签 + private function makeUserDefaultLabels($userId) + { + $labels = explode(',', self::$systemConfig['initial_labels_for_user']); + + foreach ($labels as $vo) { + $userLabel = new UserLabel(); + $userLabel->user_id = $userId; + $userLabel->label_id = $vo; + $userLabel->save(); + } + } +} diff --git a/app/Console/Commands/upgradeUserPassword.php b/app/Console/Commands/upgradeUserPassword.php new file mode 100644 index 000000000..31bef942e --- /dev/null +++ b/app/Console/Commands/upgradeUserPassword.php @@ -0,0 +1,33 @@ +HASH)'; + + public function __construct() + { + parent::__construct(); + } + + public function handle() + { + Log::info('----------------------------【升级用户登录密码】开始----------------------------'); + + // 将用户的登录密码由原有的md5升级为hash,统一升级为与用户名相同的密码 + $userList = User::query()->get(); + foreach ($userList as $user) { + User::query()->where('id', $user->id)->update(['password' => Hash::make($user->username)]); + Log::info('----------------------------升级用户[' . $user->username . ']的登录密码----------------------------'); + } + + Log::info('----------------------------【升级用户登录密码】结束----------------------------'); + } +} diff --git a/app/Console/Commands/upgradeUserSpeedLimit.php b/app/Console/Commands/upgradeUserSpeedLimit.php new file mode 100644 index 000000000..eaa260f0b --- /dev/null +++ b/app/Console/Commands/upgradeUserSpeedLimit.php @@ -0,0 +1,36 @@ +get(); + foreach ($userList as $user) { + $data = [ + 'speed_limit_per_con' => 10737418240, + 'speed_limit_per_user' => 10737418240 + ]; + + User::query()->where('id', $user->id)->update($data); + Log::info('---用户[ID:' . $user->id . ' - ' . $user->username . ']的限速字段值被重置为10G---'); + } + + Log::info('----------------------------【重置用户限速字段】结束----------------------------'); + } +} diff --git a/app/Console/Commands/upgradeUserSubscribe.php b/app/Console/Commands/upgradeUserSubscribe.php new file mode 100644 index 000000000..cc2348dbb --- /dev/null +++ b/app/Console/Commands/upgradeUserSubscribe.php @@ -0,0 +1,42 @@ +get(); + foreach ($userList as $user) { + // 如果未生成过订阅码则生成一个 + $subscribe = UserSubscribe::query()->where('user_id', $user->id)->first(); + if (!$subscribe) { + $subscribe = new UserSubscribe(); + $subscribe->user_id = $user->id; + $subscribe->code = Helpers::makeSubscribeCode(); + $subscribe->times = 0; + $subscribe->save(); + + Log::info('---生成用户[ID:' . $user->id . ' - ' . $user->username . ']的订阅码---'); + } + } + + Log::info('----------------------------【生成用户订阅码】结束----------------------------'); + } +} diff --git a/app/Console/Commands/upgradeUserVmessId.php b/app/Console/Commands/upgradeUserVmessId.php new file mode 100644 index 000000000..c406ada0d --- /dev/null +++ b/app/Console/Commands/upgradeUserVmessId.php @@ -0,0 +1,32 @@ +get(); + foreach ($userList as $user) { + if (!isset($user->vmess_id)) { + \Log::error("USER表缺失vmess_id字段,请先维护数据库字典"); + break; + } + + if (!$user->vmess_id) { + User::query()->where('id', $user->id)->update(['vmess_id' => createGuid()]); + } + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 622e774b3..0cab3badb 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -13,28 +13,59 @@ class Kernel extends ConsoleKernel * @var array */ protected $commands = [ - // + \App\Console\Commands\AutoJob::class, + \App\Console\Commands\AutoClearLog::class, + \App\Console\Commands\AutoDecGoodsTraffic::class, + \App\Console\Commands\AutoResetUserTraffic::class, + \App\Console\Commands\AutoCheckNodeTCP::class, + \App\Console\Commands\AutoStatisticsNodeDailyTraffic::class, + \App\Console\Commands\AutoStatisticsNodeHourlyTraffic::class, + \App\Console\Commands\AutoStatisticsUserDailyTraffic::class, + \App\Console\Commands\AutoStatisticsUserHourlyTraffic::class, + \App\Console\Commands\UserTrafficAbnormalAutoWarning::class, + \App\Console\Commands\UserExpireAutoWarning::class, + \App\Console\Commands\UserTrafficAutoWarning::class, + \App\Console\Commands\upgradeUserLabels::class, + \App\Console\Commands\upgradeUserPassword::class, + \App\Console\Commands\upgradeUserSpeedLimit::class, + \App\Console\Commands\upgradeUserSubscribe::class, + \App\Console\Commands\upgradeUserVmessId::class, + \App\Console\Commands\AutoReportNode::class, ]; /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * * @return void */ protected function schedule(Schedule $schedule) { - // $schedule->command('inspire') - // ->hourly(); + $schedule->command('autoJob')->everyMinute(); + $schedule->command('autoClearLog')->everyThirtyMinutes(); + $schedule->command('autoDecGoodsTraffic')->everyTenMinutes(); + $schedule->command('autoResetUserTraffic')->daily(); + $schedule->command('autoCheckNodeTCP')->everyMinute(); + $schedule->command('autoStatisticsNodeDailyTraffic')->dailyAt('23:55'); + $schedule->command('autoStatisticsNodeHourlyTraffic')->hourly(); + $schedule->command('autoStatisticsUserDailyTraffic')->dailyAt('23:50'); + $schedule->command('autoStatisticsUserHourlyTraffic')->hourly(); + $schedule->command('userTrafficAbnormalAutoWarning')->hourly(); + $schedule->command('userExpireAutoWarning')->dailyAt('20:00'); + $schedule->command('userTrafficAutoWarning')->dailyAt('10:30'); + $schedule->command('autoReportNode')->dailyAt('09:00'); } /** - * Register the Closure based commands for the application. + * Register the commands for the application. * * @return void */ protected function commands() { + $this->load(__DIR__.'/Commands'); + require base_path('routes/console.php'); } } diff --git a/app/Events/Event.php b/app/Events/Event.php new file mode 100644 index 000000000..aa872ece8 --- /dev/null +++ b/app/Events/Event.php @@ -0,0 +1,36 @@ +expectsJson()) { - return response()->json(['error' => 'Unauthenticated.'], 401); + // 捕获访问异常 + if ($exception instanceof NotFoundHttpException) { + \Log::info("异常请求:" . $request->fullUrl() . ",IP:" . getClientIp()); + + if ($request->ajax()) { + return response()->json(['status' => 'fail', 'data' => '', 'message' => 'Page Not Found']); + } else { + return response()->view('auth.error', ['message' => 'Page Not Found']); + } + } + + // 捕获身份校验异常 + if ($exception instanceof AuthenticationException) { + if ($request->ajax()) { + return response()->json(['status' => 'fail', 'data' => '', 'message' => 'Unauthorized']); + } else { + return response()->view('auth.error', ['message' => 'Unauthorized']); + } + } + + // 捕获CSRF异常 + if ($exception instanceof TokenMismatchException) { + if ($request->ajax()) { + return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error, Please Refresh Page, Try One More Time']); + } else { + return response()->view('auth.error', ['message' => 'System Error, Please Refresh Page, Try One More Time']); + } + } + + // 捕获反射异常 + if ($exception instanceof ReflectionException) { + if ($request->ajax()) { + return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error']); + } else { + return response()->view('auth.error', ['message' => 'System Error']); + } + } + + // 捕获系统错误异常 + if ($exception instanceof ErrorException) { + if ($request->ajax()) { + return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error']); + } else { + return response()->view('auth.error', ['message' => 'System Error, See Logs']); + } } - return redirect()->guest(route('login')); + return parent::render($request, $exception); } } diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 21fad3c58..29a4771cc 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -2,54 +2,134 @@ namespace App\Http\Controllers; +use App\Components\Helpers; +use App\Components\IPIP; +use App\Components\QQWry; +use App\Http\Models\Article; +use App\Http\Models\Config; +use App\Http\Models\Country; +use App\Http\Models\EmailLog; +use App\Http\Models\Invite; +use App\Http\Models\Label; +use App\Http\Models\Level; +use App\Http\Models\Order; +use App\Http\Models\ReferralApply; +use App\Http\Models\ReferralLog; use App\Http\Models\SsConfig; +use App\Http\Models\SsGroup; +use App\Http\Models\SsGroupNode; use App\Http\Models\SsNode; use App\Http\Models\SsNodeInfo; +use App\Http\Models\SsNodeIp; +use App\Http\Models\SsNodeLabel; use App\Http\Models\SsNodeOnlineLog; +use App\Http\Models\SsNodeTrafficDaily; +use App\Http\Models\SsNodeTrafficHourly; use App\Http\Models\User; +use App\Http\Models\UserBalanceLog; +use App\Http\Models\UserBanLog; +use App\Http\Models\UserLabel; +use App\Http\Models\UserLoginLog; +use App\Http\Models\UserSubscribe; +use App\Http\Models\UserTrafficDaily; +use App\Http\Models\UserTrafficHourly; use App\Http\Models\UserTrafficLog; +use App\Http\Models\UserTrafficModifyLog; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use Illuminate\Http\Request; use Redirect; use Response; - -class AdminController extends BaseController +use Session; +use Log; +use DB; +use Auth; +use Hash; + +/** + * 管理员控制器 + * + * Class AdminController + * + * @package App\Http\Controllers + */ +class AdminController extends Controller { + protected static $systemConfig; + + function __construct() + { + self::$systemConfig = Helpers::systemConfig(); + } + public function index(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); + $past = strtotime(date('Y-m-d', strtotime("-" . self::$systemConfig['expire_days'] . " days"))); + + $view['expireDays'] = self::$systemConfig['expire_days']; + $view['totalUserCount'] = User::query()->count(); // 总用户数 + $view['enableUserCount'] = User::query()->where('enable', 1)->count(); // 有效用户数 + $view['activeUserCount'] = User::query()->where('t', '>=', $past)->count(); // 活跃用户数 + $view['unActiveUserCount'] = User::query()->where('t', '<=', $past)->where('enable', 1)->where('t', '>', 0)->count(); // 不活跃用户数 + $view['onlineUserCount'] = User::query()->where('t', '>=', time() - 600)->count(); // 10分钟内在线用户数 + $view['expireWarningUserCount'] = User::query()->where('expire_time', '>=', date('Y-m-d', strtotime("now")))->where('expire_time', '<=', date('Y-m-d', strtotime("+" . self::$systemConfig['expire_days'] . " days")))->count(); // 临近过期用户数 + $view['largeTrafficUserCount'] = User::query()->whereRaw('(u + d) >= 107374182400')->whereIn('status', [0, 1])->count(); // 流量超过100G的用户 + + // 1小时内流量异常用户 + $tempUsers = []; + $userTotalTrafficList = UserTrafficHourly::query()->where('node_id', 0)->where('total', '>', 104857600)->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))->groupBy('user_id')->selectRaw("user_id, sum(total) as totalTraffic")->get(); // 只统计100M以上的记录,加快速度 + if (!$userTotalTrafficList->isEmpty()) { + foreach ($userTotalTrafficList as $vo) { + if ($vo->totalTraffic > (self::$systemConfig['traffic_ban_value'] * 1024 * 1024 * 1024)) { + $tempUsers[] = $vo->user_id; + } + } } + $view['flowAbnormalUserCount'] = User::query()->whereIn('id', $tempUsers)->count(); + - $now = time(); - $past = strtotime(date('Y-m-d H:i:s', strtotime("-3 days"))); - $online = time() - 600; + $view['nodeCount'] = SsNode::query()->count(); + $view['unnormalNodeCount'] = SsNode::query()->where('status', 0)->count(); - $view['userCount'] = User::count(); - $view['activeUserCount'] = User::whereBetween('t', [$past, $now])->count(); - $view['onlineUserCount'] = User::where('t', '>=', $online)->count(); - $view['nodeCount'] = SsNode::count(); - $flowCount = UserTrafficLog::sum('u') + UserTrafficLog::sum('d'); - $flowCount = $this->flowAutoShow($flowCount); - $view['flowCount'] = $flowCount; + $flowCount = SsNodeTrafficDaily::query()->where('created_at', '>=', date('Y-m-d 00:00:00', strtotime("-30 days")))->sum('total'); + $view['flowCount'] = flowAutoShow($flowCount); + $totalFlowCount = SsNodeTrafficDaily::query()->sum('total'); + $view['totalFlowCount'] = flowAutoShow($totalFlowCount); - return Response::view('admin/index', $view); + $view['totalBalance'] = User::query()->sum('balance') / 100; + $view['totalWaitRefAmount'] = ReferralLog::query()->whereIn('status', [0, 1])->sum('ref_amount') / 100; + $view['totalRefAmount'] = ReferralApply::query()->where('status', 2)->sum('amount') / 100; + + $view['totalOrder'] = Order::query()->count(); + $view['totalOnlinePayOrder'] = Order::query()->where('pay_way', 2)->count(); + $view['totalSuccessOrder'] = Order::query()->where('status', 2)->count(); + $view['todaySuccessOrder'] = Order::query()->where('status', 2)->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('created_at', '<=', date('Y-m-d 23:59:59'))->count(); + + return Response::view('admin.index', $view); } // 用户列表 public function userList(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } - - $username = $request->get('username'); - $wechat = $request->get('wechat'); - $qq = $request->get('qq'); - $port = $request->get('port'); - $pay_way = $request->get('pay_way'); + $id = intval($request->get('id')); + $username = trim($request->get('username')); + $wechat = trim($request->get('wechat')); + $qq = trim($request->get('qq')); + $port = intval($request->get('port')); + $pay_way = intval($request->get('pay_way')); + $status = $request->get('status'); $enable = $request->get('enable'); + $online = $request->get('online'); + $unActive = $request->get('unActive'); + $flowAbnormal = $request->get('flowAbnormal'); + $expireWarning = $request->get('expireWarning'); + $largeTraffic = $request->get('largeTraffic'); + + $query = User::query()->with(['subscribe']); + if (!empty($id)) { + $query->where('id', $id); + } - $query = User::query(); if (!empty($username)) { $query->where('username', 'like', '%' . $username . '%'); } @@ -62,204 +142,391 @@ public function userList(Request $request) $query->where('qq', 'like', '%' . $qq . '%'); } - if (!empty($port)) { - $query->where('port', intval($port)); + if ($port != '') { + $query->where('port', $port); } - if (!empty($pay_way)) { - $query->where('pay_way', intval($pay_way)); + if ($pay_way != '') { + $query->where('pay_way', $pay_way); + } + + if ($status != '') { + $query->where('status', intval($status)); } if ($enable != '') { $query->where('enable', intval($enable)); } - $userList = $query->orderBy('id', 'desc')->paginate(10); + // 流量超过100G的 + if ($largeTraffic) { + $query->whereIn('status', [0, 1])->whereRaw('(u + d) >= 107374182400'); + } + + // 临近过期提醒 + if ($expireWarning) { + $query->where('expire_time', '>=', date('Y-m-d', strtotime("now")))->where('expire_time', '<=', date('Y-m-d', strtotime("+" . self::$systemConfig['expire_days'] . " days"))); + } + + // 当前在线 + if ($online) { + $query->where('t', '>=', time() - 600); + } + + // 不活跃用户 + if ($unActive) { + $query->where('t', '>', 0)->where('t', '<=', strtotime(date('Y-m-d', strtotime("-" . self::$systemConfig['expire_days'] . " days"))))->where('enable', 1); + } + + // 1小时内流量异常用户 + if ($flowAbnormal) { + $tempUsers = []; + $userTotalTrafficList = UserTrafficHourly::query()->where('node_id', 0)->where('total', '>', 104857600)->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))->groupBy('user_id')->selectRaw("user_id, sum(total) as totalTraffic")->get(); // 只统计100M以上的记录,加快速度 + if (!$userTotalTrafficList->isEmpty()) { + foreach ($userTotalTrafficList as $vo) { + if ($vo->totalTraffic > (self::$systemConfig['traffic_ban_value'] * 1024 * 1024 * 1024)) { + $tempUsers[] = $vo->user_id; + } + } + } + $query->whereIn('id', $tempUsers); + } + + $userList = $query->orderBy('id', 'desc')->paginate(15)->appends($request->except('page')); foreach ($userList as &$user) { - $user->transfer_enable = $this->flowAutoShow($user->transfer_enable); - $user->used_flow = $this->flowAutoShow($user->u + $user->d); + $user->transfer_enable = flowAutoShow($user->transfer_enable); + $user->used_flow = flowAutoShow($user->u + $user->d); + if ($user->expire_time < date('Y-m-d', strtotime("now"))) { + $user->expireWarning = -1; // 已过期 + } elseif ($user->expire_time == date('Y-m-d', strtotime("now"))) { + $user->expireWarning = 0; // 今天过期 + } elseif ($user->expire_time > date('Y-m-d', strtotime("now")) && $user->expire_time <= date('Y-m-d', strtotime("+30 days"))) { + $user->expireWarning = 1; // 最近一个月过期 + } else { + $user->expireWarning = 2; // 大于一个月过期 + } + + // 流量异常警告 + $time = date('Y-m-d H:i:s', time() - 3900); + $totalTraffic = UserTrafficHourly::query()->where('user_id', $user->id)->where('node_id', 0)->where('created_at', '>=', $time)->sum('total'); + $user->trafficWarning = $totalTraffic > (self::$systemConfig['traffic_ban_value'] * 1024 * 1024 * 1024) ? 1 : 0; + + // 订阅地址 + $user->link = (self::$systemConfig['subscribe_domain'] ? self::$systemConfig['subscribe_domain'] : self::$systemConfig['website_url']) . '/s/' . $user->subscribe->code; } $view['userList'] = $userList; - return Response::view('admin/userList', $view); + return Response::view('admin.userList', $view); } // 添加账号 public function addUser(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + if ($request->isMethod('POST')) { + // 校验username是否已存在 + $exists = User::query()->where('username', $request->get('username'))->first(); + if ($exists) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '用户名已存在,请重新输入']); + } - if ($request->method() == 'POST') { - $username = $request->get('username'); - $password = $request->get('password'); - $port = $request->get('port'); - $passwd = $request->get('passwd'); - $transfer_enable = $request->get('transfer_enable'); - $enable = $request->get('enable'); - $method = $request->get('method'); - $custom_method = $request->get('custom_method'); - $protocol = $request->get('protocol'); - $protocol_param = $request->get('protocol_param'); - $obfs = $request->get('obfs'); - $obfs_param = $request->get('obfs_param'); - $wechat = $request->get('wechat'); - $qq = $request->get('qq'); - $usage = $request->get('usage'); - $pay_way = $request->get('pay_way'); - $balance = $request->get('balance'); - $enable_time = $request->get('enable_time'); - $expire_time = $request->get('expire_time'); - $remark = $request->get('remark'); - $is_admin = $request->get('is_admin'); + if (!$request->get('usage')) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '请至少选择一种用途']); + } - // 密码为空时生成默认密码 - if (empty($password)) { - $str = $this->makeRandStr(); - $password = md5($str); - } else { - $password = md5($password); - } - - $ret = User::create([ - 'username' => $username, - 'password' => $password, - 'port' => $port, - 'passwd' => empty($passwd) ? $this->makeRandStr() : $passwd, // SS密码为空时生成默认密码 - 'transfer_enable' => $transfer_enable, - 'enable' => $enable, - 'method' => $method, - 'custom_method' => $custom_method, - 'protocol' => $protocol, - 'protocol_param' => $protocol_param, - 'obfs' => $obfs, - 'obfs_param' => $obfs_param, - 'wechat' => $wechat, - 'qq' => $qq, - 'usage' => $usage, - 'pay_way' => $pay_way, - 'balance' => $balance, - 'enable_time' => empty($enable_time) ? date('Y-m-d') : $enable_time, - 'expire_time' => empty($expire_time) ? '2099-1-1' : $expire_time, - 'remark' => $remark, - 'is_admin' => $is_admin, - 'reg_ip' => $request->getClientIp() - ]); + $user = new User(); + $user->username = trim($request->get('username')); + $user->password = trim($request->get('password')) ? Hash::make(trim($request->get('password'))) : Hash::make(makeRandStr()); + $user->port = $request->get('port'); + $user->passwd = empty($request->get('passwd')) ? makeRandStr() : $request->get('passwd'); + $user->vmess_id = $request->get('vmess_id') ? trim($request->get('vmess_id')) : createGuid(); + $user->transfer_enable = toGB($request->get('transfer_enable', 0)); + $user->enable = intval($request->get('enable', 0)); + $user->method = $request->get('method'); + $user->protocol = $request->get('protocol'); + $user->protocol_param = $request->get('protocol_param') ? $request->get('protocol_param') : ''; + $user->obfs = $request->get('obfs'); + $user->obfs_param = $request->get('obfs_param') ? $request->get('obfs_param') : ''; + $user->speed_limit_per_con = intval($request->get('speed_limit_per_con')); + $user->speed_limit_per_user = intval($request->get('speed_limit_per_user')); + $user->gender = intval($request->get('gender')); + $user->wechat = $request->get('wechat') ? $request->get('wechat') : ''; + $user->qq = $request->get('qq') ? $request->get('qq') : ''; + $user->usage = $request->get('usage'); + $user->pay_way = $request->get('pay_way'); + $user->balance = 0; + $user->enable_time = empty($request->get('enable_time')) ? date('Y-m-d') : $request->get('enable_time'); + $user->expire_time = empty($request->get('expire_time')) ? date('Y-m-d', strtotime("+365 days")) : $request->get('expire_time'); + $user->remark = str_replace("eval", "", str_replace("atob", "", $request->get('remark'))); + $user->level = $request->get('level') ? $request->get('level') : 1; + $user->is_admin = 0; + $user->reg_ip = getClientIp(); + $user->referral_uid = 0; + $user->traffic_reset_day = 0; + $user->status = $request->get('status') ? $request->get('status') : 1; + $user->save(); + + if ($user->id) { + // 生成订阅码 + $subscribe = new UserSubscribe(); + $subscribe->user_id = $user->id; + $subscribe->code = Helpers::makeSubscribeCode(); + $subscribe->times = 0; + $subscribe->save(); + + // 生成用户标签 + $this->makeUserLabels($user->id, $request->get('labels')); + + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($user->id, 0, 0, toGB($request->get('transfer_enable', 0)), '后台手动添加用户'); - if ($ret) { return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']); } else { return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败']); } } else { - // 最后一个可用端口 - $last_user = User::orderBy('id', 'desc')->first(); - $view['last_port'] = $last_user->port + 1; + // 生成一个可用端口 + $view['last_port'] = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + $view['method_list'] = Helpers::methodList(); + $view['protocol_list'] = Helpers::protocolList(); + $view['obfs_list'] = Helpers::obfsList(); + $view['level_list'] = Helpers::levelList(); + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); + $view['initial_labels'] = explode(",", Helpers::systemConfig()['initial_labels_for_user']); + + return Response::view('admin.addUser', $view); + } + } - // 加密方式、协议、混淆 - $view['method_list'] = $this->methodList(); - $view['protocol_list'] = $this->protocolList(); - $view['obfs_list'] = $this->obfsList(); + // 批量生成账号 + public function batchAddUsers(Request $request) + { + DB::beginTransaction(); + try { + for ($i = 0; $i < 5; $i++) { + // 生成一个可用端口 + $port = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + + $user = new User(); + $user->username = '批量生成-' . makeRandStr(); + $user->password = Hash::make(makeRandStr()); + $user->port = $port; + $user->passwd = makeRandStr(); + $user->vmess_id = createGuid(); + $user->enable = 1; + $user->method = Helpers::getDefaultMethod(); + $user->protocol = Helpers::getDefaultProtocol(); + $user->protocol_param = ''; + $user->obfs = Helpers::getDefaultObfs(); + $user->obfs_param = ''; + $user->usage = 1; + $user->transfer_enable = toGB(1024); + $user->enable_time = date('Y-m-d'); + $user->expire_time = date('Y-m-d', strtotime("+365 days")); + $user->remark = ''; + $user->reg_ip = getClientIp(); + $user->referral_uid = 0; + $user->traffic_reset_day = 0; + $user->status = 1; + $user->save(); + + if ($user->id) { + // 生成订阅码 + $subscribe = new UserSubscribe(); + $subscribe->user_id = $user->id; + $subscribe->code = Helpers::makeSubscribeCode(); + $subscribe->times = 0; + $subscribe->save(); + + // 初始化默认标签 + if (!empty(self::$systemConfig['initial_labels_for_user'])) { + $labels = explode(',', self::$systemConfig['initial_labels_for_user']); + $this->makeUserLabels($user->id, $labels); + } + + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($user->id, 0, 0, toGB(1024), '后台批量生成用户'); + } + } - return Response::view('admin/addUser', $view); + DB::commit(); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '批量生成账号成功']); + } catch (\Exception $e) { + DB::rollBack(); + + return Response::json(['status' => 'fail', 'data' => '', 'message' => '批量生成账号失败:' . $e->getMessage()]); } } // 编辑账号 public function editUser(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + $id = intval($request->get('id')); - $id = $request->get('id'); - if ($request->method() == 'POST') { - $username = $request->get('username'); + if ($request->isMethod('POST')) { + $username = trim($request->get('username')); $password = $request->get('password'); - $port = $request->get('port'); + $port = intval($request->get('port')); $passwd = $request->get('passwd'); + $vmess_id = $request->get('vmess_id') ? trim($request->get('vmess_id')) : createGuid(); $transfer_enable = $request->get('transfer_enable'); - $enable = $request->get('enable'); + $enable = intval($request->get('enable')); $method = $request->get('method'); - $custom_method = $request->get('custom_method'); $protocol = $request->get('protocol'); $protocol_param = $request->get('protocol_param'); $obfs = $request->get('obfs'); $obfs_param = $request->get('obfs_param'); + $speed_limit_per_con = intval($request->get('speed_limit_per_con')); + $speed_limit_per_user = intval($request->get('speed_limit_per_user')); + $gender = intval($request->get('gender')); $wechat = $request->get('wechat'); $qq = $request->get('qq'); $usage = $request->get('usage'); $pay_way = $request->get('pay_way'); - $balance = $request->get('balance'); + $status = $request->get('status'); + $labels = $request->get('labels'); $enable_time = $request->get('enable_time'); $expire_time = $request->get('expire_time'); - $remark = $request->get('remark'); + $remark = str_replace("eval", "", str_replace("atob", "", $request->get('remark'))); + $level = $request->get('level'); $is_admin = $request->get('is_admin'); - $data = [ - 'username' => $username, - 'port' => $port, - 'passwd' => $passwd, - 'transfer_enable' => $this->toGB($transfer_enable), - 'enable' => $enable, - 'method' => $method, - 'custom_method' => $custom_method, - 'protocol' => $protocol, - 'protocol_param' => $protocol_param, - 'obfs' => $obfs, - 'obfs_param' => $obfs_param, - 'wechat' => $wechat, - 'qq' => $qq, - 'usage' => $usage, - 'pay_way' => $pay_way, - 'balance' => $balance, - 'enable_time' => empty($enable_time) ? date('Y-m-d') : $enable_time, - 'expire_time' => empty($expire_time) ? '2099-1-1' : $expire_time, - 'remark' => $remark, - 'is_admin' => $is_admin - ]; + // 校验username是否已存在 + $exists = User::query()->where('id', '<>', $id)->where('username', $username)->first(); + if ($exists) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '用户名已存在,请重新输入']); + } - if (!empty($password)) { - $data['password'] = md5($password); + // 校验端口是否已存在 + $exists = User::query()->where('id', '<>', $id)->where('port', '>', 0)->where('port', $port)->first(); + if ($exists) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '端口已存在,请重新输入']); } - $ret = User::where('id', $id)->update($data); - if ($ret) { + // 禁止取消默认管理员 + if ($id == 1 && $is_admin == 0) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '系统默认管理员不可取消']); + } + + if (!$request->get('usage')) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '请至少选择一种用途']); + } + + // 用户编辑前的信息 + $user = User::query()->where('id', $id)->first(); + + DB::beginTransaction(); + try { + $data = [ + 'username' => $username, + 'port' => $port, + 'passwd' => $passwd, + 'vmess_id' => $vmess_id, + 'transfer_enable' => toGB($transfer_enable), + 'enable' => $status < 0 ? 0 : $enable, // 如果禁止登陆则同时禁用代理 + 'method' => $method, + 'protocol' => $protocol, + 'protocol_param' => $protocol_param, + 'obfs' => $obfs, + 'obfs_param' => $obfs_param, + 'speed_limit_per_con' => $speed_limit_per_con, + 'speed_limit_per_user' => $speed_limit_per_user, + 'gender' => $gender, + 'wechat' => $wechat, + 'qq' => $qq, + 'usage' => $usage, + 'pay_way' => $pay_way, + 'status' => $status, + 'enable_time' => empty($enable_time) ? date('Y-m-d') : $enable_time, + 'expire_time' => empty($expire_time) ? date('Y-m-d', strtotime("+365 days")) : $expire_time, + 'remark' => $remark, + 'level' => $level, + ]; + + // 只有admin才有权限操作管理员属性 + if (Auth::user()->id == 1) { + $data['is_admin'] = $is_admin; + } + + if (!empty($password)) { + if (!(env('APP_DEMO') && $id == 1)) { // 演示环境禁止修改管理员密码 + $data['password'] = Hash::make($password); + } + } + + User::query()->where('id', $id)->update($data); + + // 重新生成用户标签 + $this->makeUserLabels($id, $labels); + + // 写入用户流量变动记录 + if ($user->transfer_enable != toGB($transfer_enable)) { + Helpers::addUserTrafficModifyLog($id, 0, $user->transfer_enable, toGB($transfer_enable), '后台手动编辑用户'); + } + + DB::commit(); + return Response::json(['status' => 'success', 'data' => '', 'message' => '编辑成功']); - } else { + } catch (\Exception $e) { + DB::rollBack(); + Log::error('编辑用户信息异常:' . $e->getMessage()); + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败']); } } else { - $user = User::where('id', $id)->first(); - if (!empty($user)) { - $user->transfer_enable = $this->flowToGB($user->transfer_enable); + $user = User::query()->with(['label', 'referral'])->where('id', $id)->first(); + if ($user) { + $user->transfer_enable = flowToGB($user->transfer_enable); + + // 处理标签 + $label = []; + foreach ($user->label as $vo) { + $label[] = $vo->label_id; + } + $user->labels = $label; + + // 处理用途 + $user->usage = explode(',', $user->usage); } $view['user'] = $user; + $view['method_list'] = Helpers::methodList(); + $view['protocol_list'] = Helpers::protocolList(); + $view['obfs_list'] = Helpers::obfsList(); + $view['level_list'] = Helpers::levelList(); + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); - // 加密方式、协议、混淆 - $view['method_list'] = $this->methodList(); - $view['protocol_list'] = $this->protocolList(); - $view['obfs_list'] = $this->obfsList(); - - return Response::view('admin/editUser', $view); + return Response::view('admin.editUser', $view); } } // 删除用户 public function delUser(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); + $id = $request->get('id'); + + if ($id <= 1) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '系统管理员不可删除']); } - $id = $request->get('id'); - $user = User::where('id', $id)->delete(); - if ($user) { + DB::beginTransaction(); + try { + User::query()->where('id', $id)->delete(); + UserSubscribe::query()->where('user_id', $id)->delete(); + UserBanLog::query()->where('user_id', $id)->delete(); + UserLabel::query()->where('user_id', $id)->delete(); + UserBalanceLog::query()->where('user_id', $id)->delete(); + UserTrafficModifyLog::query()->where('user_id', $id)->delete(); + UserLoginLog::query()->where('user_id', $id)->delete(); + + DB::commit(); + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); - } else { + } catch (\Exception $e) { + Log::error($e); + DB::rollBack(); + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败']); } } @@ -267,306 +534,791 @@ public function delUser(Request $request) // 节点列表 public function nodeList(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); + $status = $request->input('status'); + + $query = SsNode::query(); + + if ($status != '') { + $query->where('status', intval($status)); } - $nodeList = SsNode::paginate(10); + $nodeList = $query->orderBy('status', 'desc')->orderBy('id', 'asc')->paginate(15)->appends($request->except('page')); foreach ($nodeList as &$node) { // 在线人数 - $online_log = SsNodeOnlineLog::where('node_id', $node->id)->orderBy('id', 'desc')->first(); + $online_log = SsNodeOnlineLog::query()->where('node_id', $node->id)->where('log_time', '>=', strtotime("-5 minutes"))->orderBy('id', 'desc')->first(); $node->online_users = empty($online_log) ? 0 : $online_log->online_user; // 已产生流量 - $u = UserTrafficLog::where('node_id', $node->id)->sum('u'); - $d = UserTrafficLog::where('node_id', $node->id)->sum('d'); - $node->transfer = $this->flowAutoShow($u + $d); + $totalTraffic = SsNodeTrafficDaily::query()->where('node_id', $node->id)->sum('total'); + $node->transfer = flowAutoShow($totalTraffic); - // 负载 - $node_info = SsNodeInfo::where('node_id', $node->id)->orderBy('id', 'desc')->first(); - $node->load = empty($node_info->load) ? 0 : $node_info->load; + // 负载(10分钟以内) + $node_info = SsNodeInfo::query()->where('node_id', $node->id)->where('log_time', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->first(); + $node->load = $node->is_transit ? '' : (empty($node_info) || empty($node_info->load) ? '离线' : $node_info->load); + $node->uptime = empty($node_info) ? 0 : seconds2time($node_info->uptime); } $view['nodeList'] = $nodeList; - return Response::view('admin/nodeList', $view); + return Response::view('admin.nodeList', $view); } // 添加节点 public function addNode(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + if ($request->isMethod('POST')) { + if ($request->get('ssh_port') <= 0 || $request->get('ssh_port') >= 65535) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败:SSH端口不合法']); + } - if ($request->method() == 'POST') { - $name = $request->get('name'); - $server = $request->get('server'); - $method = $request->get('method'); - $custom_method = $request->get('custom_method'); - $protocol = $request->get('protocol'); - $protocol_param = $request->get('protocol_param'); - $obfs = $request->get('obfs'); - $obfs_param = $request->get('obfs_param'); - $traffic_rate = $request->get('traffic_rate'); - $bandwidth = $request->get('bandwidth'); - $traffic = $request->get('traffic'); - $monitor_url = $request->get('monitor_url'); - $sort = $request->get('sort'); - $status = $request->get('status'); + if (false === filter_var($request->get('ip'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败:IPv4地址不合法']); + } - SsNode::create([ - 'name' => $name, - 'server' => $server, - 'method' => $method, - 'custom_method' => $custom_method, - 'protocol' => $protocol, - 'protocol_param' => $protocol_param, - 'obfs' => $obfs, - 'obfs_param' => $obfs_param, - 'traffic_rate' => $traffic_rate, - 'bandwidth' => $bandwidth, - 'traffic' => $traffic, - 'monitor_url' => $monitor_url, - 'sort' => $sort, - 'status' => $status, - ]); + if ($request->get('ipv6') && false === filter_var($request->get('ipv6'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败:IPv6地址不合法']); + } - return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']); - } else { - // 加密方式、协议、混淆 - $view['method_list'] = $this->methodList(); - $view['protocol_list'] = $this->protocolList(); - $view['obfs_list'] = $this->obfsList(); + if ($request->get('server')) { + $domain = $request->get('server'); + $domain = explode('.', $domain); + $domainSuffix = end($domain); // 取得域名后缀 + + if (!in_array($domainSuffix, \config('domains'))) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '绑定域名不合法']); + } + } + + // TODO:判断是否已存在绑定了相同域名的节点,提示是否要强制替换,或者不提示之前强制将其他节点的绑定域名置为空,然后发起域名绑定请求,或者请求进入队列 + + DB::beginTransaction(); + try { + $ssNode = new SsNode(); + $ssNode->type = intval($request->get('type')); + $ssNode->name = $request->get('name'); + $ssNode->group_id = $request->get('group_id') ? intval($request->get('group_id')) : 0; + $ssNode->country_code = $request->get('country_code') ? $request->get('country_code') : 'un'; + $ssNode->server = $request->get('server') ? $request->get('server') : ''; + $ssNode->ip = $request->get('ip'); + $ssNode->ipv6 = $request->get('ipv6'); + $ssNode->desc = $request->get('desc') ? $request->get('desc') : ''; + $ssNode->method = $request->get('method'); + $ssNode->protocol = $request->get('protocol'); + $ssNode->protocol_param = $request->get('protocol_param') ? $request->get('protocol_param') : ''; + $ssNode->obfs = $request->get('obfs') ? $request->get('obfs') : ''; + $ssNode->obfs_param = $request->get('obfs_param') ? $request->get('obfs_param') : ''; + $ssNode->traffic_rate = $request->get('traffic_rate') ? $request->get('traffic_rate') : 1; + $ssNode->bandwidth = $request->get('bandwidth') ? $request->get('bandwidth') : 1000; + $ssNode->traffic = $request->get('traffic') ? $request->get('traffic') : 1000; + $ssNode->monitor_url = $request->get('monitor_url') ? $request->get('monitor_url') : ''; + $ssNode->is_subscribe = intval($request->get('is_subscribe')); + $ssNode->is_nat = intval($request->get('is_nat')); + $ssNode->is_transit = intval($request->get('is_transit')); + $ssNode->ssh_port = $request->get('ssh_port') ? intval($request->get('ssh_port')) : 22; + $ssNode->is_tcp_check = intval($request->get('is_tcp_check')); + $ssNode->compatible = intval($request->get('type')) == 2 ? 0 : (intval($request->get('is_nat')) ? 0 : intval($request->get('compatible'))); + $ssNode->single = intval($request->get('single')); + $ssNode->single_force = intval($request->get('single')) ? intval($request->get('single_force')) : 0; + $ssNode->single_port = intval($request->get('single')) ? ($request->get('single_port') ? $request->get('single_port') : 443) : ''; + $ssNode->single_passwd = intval($request->get('single')) ? ($request->get('single_passwd') ? $request->get('single_passwd') : 'password') : ''; + $ssNode->single_method = intval($request->get('single')) ? $request->get('single_method') : ''; + $ssNode->single_protocol = intval($request->get('single')) ? $request->get('single_protocol') : ''; + $ssNode->single_obfs = intval($request->get('single')) ? $request->get('single_obfs') : ''; + $ssNode->sort = $request->get('sort') ? intval($request->get('sort')) : 0; + $ssNode->status = $request->get('status') ? intval($request->get('status')) : 1; + $ssNode->v2_alter_id = $request->get('v2_alter_id') ? intval($request->get('v2_alter_id')) : 16; + $ssNode->v2_port = $request->get('v2_port') ? intval($request->get('v2_port')) : 10087; + $ssNode->v2_method = $request->get('v2_method') ? $request->get('v2_method') : 'aes-128-gcm'; + $ssNode->v2_net = $request->get('v2_net') ? $request->get('v2_net') : 'tcp'; + $ssNode->v2_type = $request->get('v2_type') ? $request->get('v2_type') : 'none'; + $ssNode->v2_host = $request->get('v2_host') ? $request->get('v2_host') : ''; + $ssNode->v2_path = $request->get('v2_path') ? $request->get('v2_path') : ''; + $ssNode->v2_tls = $request->get('v2_tls') ? intval($request->get('v2_tls')) : 0; + $ssNode->v2_insider_port = $request->get('v2_insider_port') ? intval($request->get('v2_insider_port')) : 10550; + $ssNode->v2_outsider_port = $request->get('v2_outsider_port') ? intval($request->get('v2_outsider_port')) : 443; + $ssNode->save(); + + // 建立分组关联 + if ($ssNode->id && $request->get('group_id', 0)) { + $ssGroupNode = new SsGroupNode(); + $ssGroupNode->group_id = $request->get('group_id', 0); + $ssGroupNode->node_id = $ssNode->id; + $ssGroupNode->save(); + } + + // 生成节点标签 + $labels = $request->get('labels'); + if ($ssNode->id && !empty($labels)) { + foreach ($labels as $label) { + $ssNodeLabel = new SsNodeLabel(); + $ssNodeLabel->node_id = $ssNode->id; + $ssNodeLabel->label_id = $label; + $ssNodeLabel->save(); + } + } + + DB::commit(); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']); + } catch (\Exception $e) { + DB::rollBack(); + Log::error('添加节点信息异常:' . $e->getMessage()); - return Response::view('admin/addNode', $view); + return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败:' . $e->getMessage()]); + } + } else { + $view['method_list'] = Helpers::methodList(); + $view['protocol_list'] = Helpers::protocolList(); + $view['obfs_list'] = Helpers::obfsList(); + $view['level_list'] = Helpers::levelList(); + $view['group_list'] = SsGroup::query()->get(); + $view['country_list'] = Country::query()->orderBy('country_code', 'asc')->get(); + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); + + return Response::view('admin.addNode', $view); } } // 编辑节点 public function editNode(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } - $id = $request->get('id'); - if ($request->method() == 'POST') { - $name = $request->get('name'); - $server = $request->get('server'); - $method = $request->get('method'); - $custom_method = $request->get('custom_method'); - $protocol = $request->get('protocol'); - $protocol_param = $request->get('protocol_param'); - $obfs = $request->get('obfs'); - $obfs_param = $request->get('obfs_param'); - $traffic_rate = $request->get('traffic_rate'); - $bandwidth = $request->get('bandwidth'); - $traffic = $request->get('traffic'); - $monitor_url = $request->get('monitor_url'); - $sort = $request->get('sort'); - $status = $request->get('status'); - $data = [ - 'name' => $name, - 'server' => $server, - 'method' => $method, - 'custom_method' => $custom_method, - 'protocol' => $protocol, - 'protocol_param' => $protocol_param, - 'obfs' => $obfs, - 'obfs_param' => $obfs_param, - 'traffic_rate' => $traffic_rate, - 'bandwidth' => $bandwidth, - 'traffic' => $traffic, - 'monitor_url' => $monitor_url, - 'sort' => $sort, - 'status' => $status - ]; + if ($request->isMethod('POST')) { + if ($request->get('ssh_port') <= 0 || $request->get('ssh_port') >= 65535) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败:SSH端口不合法']); + } + + if (false === filter_var($request->get('ip'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败:IPv4地址不合法']); + } + + if ($request->get('ipv6') && false === filter_var($request->get('ipv6'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败:IPv6地址不合法']); + } + + if ($request->get('server')) { + $domain = $request->get('server'); + $domain = explode('.', $domain); + $domainSuffix = end($domain); // 取得域名后缀 + + if (!in_array($domainSuffix, \config('domains'))) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '绑定域名不合法']); + } + } + + if ($request->get('v2_alter_id') <= 0 || $request->get('v2_alter_id') >= 65535) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败:AlterId不合法']); + } + + DB::beginTransaction(); + try { + $data = [ + 'type' => intval($request->get('type')), + 'name' => $request->get('name'), + 'group_id' => $request->get('group_id') ? $request->get('group_id') : 0, + 'country_code' => $request->get('country_code'), + 'server' => $request->get('server'), + 'ip' => $request->get('ip'), + 'ipv6' => $request->get('ipv6'), + 'desc' => $request->get('desc'), + 'method' => $request->get('method'), + 'protocol' => $request->get('protocol'), + 'protocol_param' => $request->get('protocol_param'), + 'obfs' => $request->get('obfs'), + 'obfs_param' => $request->get('obfs_param'), + 'traffic_rate' => $request->get('traffic_rate'), + 'bandwidth' => $request->get('bandwidth') ? $request->get('bandwidth') : 1000, + 'traffic' => $request->get('traffic') ? $request->get('traffic') : 1000, + 'monitor_url' => $request->get('monitor_url') ? $request->get('monitor_url') : '', + 'is_subscribe' => intval($request->get('is_subscribe')), + 'is_nat' => intval($request->get('is_nat')), + 'is_transit' => intval($request->get('is_transit')), + 'ssh_port' => intval($request->get('ssh_port')), + 'is_tcp_check' => intval($request->get('is_tcp_check')), + 'compatible' => intval($request->get('type')) == 2 ? 0 : (intval($request->get('is_nat')) ? 0 : intval($request->get('compatible'))), + 'single' => intval($request->get('single')), + 'single_force' => intval($request->get('single')) ? intval($request->get('single_force')) : 0, + 'single_port' => intval($request->get('single')) ? ($request->get('single_port') ? $request->get('single_port') : 443) : '', + 'single_passwd' => intval($request->get('single')) ? ($request->get('single_passwd') ? $request->get('single_passwd') : 'password') : '', + 'single_method' => intval($request->get('single')) ? $request->get('single_method') : '', + 'single_protocol' => intval($request->get('single')) ? $request->get('single_protocol') : '', + 'single_obfs' => intval($request->get('single')) ? $request->get('single_obfs') : '', + 'sort' => intval($request->get('sort')), + 'status' => intval($request->get('status')), + 'v2_alter_id' => $request->get('v2_alter_id') ? intval($request->get('v2_alter_id')) : 16, + 'v2_port' => $request->get('v2_port') ? intval($request->get('v2_port')) : 10087, + 'v2_method' => $request->get('v2_method') ? $request->get('v2_method') : 'aes-128-gcm', + 'v2_net' => $request->get('v2_net'), + 'v2_type' => $request->get('v2_type'), + 'v2_host' => $request->get('v2_host'), + 'v2_path' => $request->get('v2_path'), + 'v2_tls' => intval($request->get('v2_tls')), + 'v2_insider_port' => intval($request->get('v2_insider_port', 10550)), + 'v2_outsider_port' => intval($request->get('v2_outsider_port', 443)) + ]; + + SsNode::query()->where('id', $id)->update($data); + + // 建立分组关联 + if ($request->get('group_id')) { + // 先删除该节点所有关联 + SsGroupNode::query()->where('node_id', $id)->delete(); + + // 建立关联 + $ssGroupNode = new SsGroupNode(); + $ssGroupNode->group_id = $request->get('group_id'); + $ssGroupNode->node_id = $id; + $ssGroupNode->save(); + } + + // 生成节点标签 + $this->makeNodeLabels($id, $request->get('labels')); + + // TODO:更新节点绑定的域名DNS(将节点IP更新到域名DNS 的A记录) + + DB::commit(); - $ret = SsNode::where('id', $id)->update($data); - if ($ret) { return Response::json(['status' => 'success', 'data' => '', 'message' => '编辑成功']); - } else { - return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败']); + } catch (\Exception $e) { + DB::rollBack(); + Log::error('编辑节点信息异常:' . $e->getMessage()); + + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败:' . $e->getMessage()]); } } else { - $view['node'] = SsNode::where('id', $id)->first(); + $node = SsNode::query()->with(['label'])->where('id', $id)->first(); + if ($node) { + $labels = []; + foreach ($node->label as $vo) { + $labels[] = $vo->label_id; + } + $node->labels = $labels; + } - // 加密方式、协议、混淆 - $view['method_list'] = $this->methodList(); - $view['protocol_list'] = $this->protocolList(); - $view['obfs_list'] = $this->obfsList(); + $view['node'] = $node; + $view['method_list'] = Helpers::methodList(); + $view['protocol_list'] = Helpers::protocolList(); + $view['obfs_list'] = Helpers::obfsList(); + $view['level_list'] = Helpers::levelList(); + $view['group_list'] = SsGroup::query()->get(); + $view['country_list'] = Country::query()->orderBy('country_code', 'asc')->get(); + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); - return Response::view('admin/editNode', $view); + return Response::view('admin.editNode', $view); } } // 删除节点 public function delNode(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); + $id = $request->get('id'); + + $node = SsNode::query()->where('id', $id)->first(); + if (!$node) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '节点不存在,请重试']); } - $id = $request->get('id'); - $user = SsNode::where('id', $id)->delete(); - if ($user) { + DB::beginTransaction(); + try { + // 删除分组关联、节点标签、节点相关日志 + SsNode::query()->where('id', $id)->delete(); + SsGroupNode::query()->where('node_id', $id)->delete(); + SsNodeLabel::query()->where('node_id', $id)->delete(); + SsNodeInfo::query()->where('node_id', $id)->delete(); + SsNodeOnlineLog::query()->where('node_id', $id)->delete(); + SsNodeTrafficDaily::query()->where('node_id', $id)->delete(); + SsNodeTrafficHourly::query()->where('node_id', $id)->delete(); + UserTrafficDaily::query()->where('node_id', $id)->delete(); + UserTrafficHourly::query()->where('node_id', $id)->delete(); + UserTrafficLog::query()->where('node_id', $id)->delete(); + + DB::commit(); + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); - } else { - return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败']); + } catch (\Exception $e) { + DB::rollBack(); + Log::error('删除节点信息异常:' . $e->getMessage()); + + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败:' . $e->getMessage()]); } } - // 流量日志 - public function trafficLog(Request $request) + // 节点流量监控 + public function nodeMonitor(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); + $node_id = $request->get('id'); + + $node = SsNode::query()->where('id', $node_id)->orderBy('sort', 'desc')->first(); + if (!$node) { + Session::flash('errorMsg', '节点不存在,请重试'); + + return Redirect::back(); + } + + // 查看流量 + $dailyData = []; + $hourlyData = []; + + // 节点一个月内的流量 + $nodeTrafficDaily = SsNodeTrafficDaily::query()->with(['info'])->where('node_id', $node->id)->where('created_at', '>=', date('Y-m', time()))->orderBy('created_at', 'asc')->pluck('total')->toArray(); + $dailyTotal = date('d', time()) - 1;//今天不算,减一 + $dailyCount = count($nodeTrafficDaily); + for ($x = 0; $x < ($dailyTotal - $dailyCount); $x++) { + $dailyData[$x] = 0; + } + for ($x = ($dailyTotal - $dailyCount); $x < $dailyTotal; $x++) { + $dailyData[$x] = round($nodeTrafficDaily[$x - ($dailyTotal - $dailyCount)] / (1024 * 1024 * 1024), 3); + } + + // 节点一天内的流量 + $nodeTrafficHourly = SsNodeTrafficHourly::query()->with(['info'])->where('node_id', $node->id)->where('created_at', '>=', date('Y-m-d', time()))->orderBy('created_at', 'asc')->pluck('total')->toArray(); + $hourlyTotal = date('H', time()); + $hourlyCount = count($nodeTrafficHourly); + for ($x = 0; $x < ($hourlyTotal - $hourlyCount); $x++) { + $hourlyData[$x] = 0; + } + for ($x = ($hourlyTotal - $hourlyCount); $x < $hourlyTotal; $x++) { + $hourlyData[$x] = round($nodeTrafficHourly[$x - ($hourlyTotal - $hourlyCount)] / (1024 * 1024 * 1024), 3); } - $trafficLogList = UserTrafficLog::with(['User', 'SsNode'])->paginate(20); - foreach ($trafficLogList as &$trafficLog) { - $trafficLog->u = $this->flowAutoShow($trafficLog->u); - $trafficLog->d = $this->flowAutoShow($trafficLog->d); - $trafficLog->traffic = $this->flowAutoShow($trafficLog->traffic); - $trafficLog->log_time = date('Y-m-d H:i:s', $trafficLog->log_time); + $view['trafficDaily'] = [ + 'nodeName' => $node->name, + 'dailyData' => "'" . implode("','", $dailyData) . "'" + ]; + + $view['trafficHourly'] = [ + 'nodeName' => $node->name, + 'hourlyData' => "'" . implode("','", $hourlyData) . "'" + ]; + + // 本月天数数据 + $monthDays = []; + $monthHasDays = date("t"); + for ($i = 1; $i <= $monthHasDays; $i++) { + $monthDays[] = $i; } - $view['trafficLogList'] = $trafficLogList; + $view['nodeName'] = $node->name; + $view['nodeServer'] = $node->server; + $view['monthDays'] = "'" . implode("','", $monthDays) . "'"; - return Response::view('admin/trafficLog', $view); + return Response::view('admin.nodeMonitor', $view); } - // 格式转换(SS转SSR) - public function convert(Request $request) + // 文章列表 + public function articleList(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + $view['list'] = Article::query()->orderBy('sort', 'desc')->paginate(15)->appends($request->except('page')); - if ($request->method() == 'POST') { - $method = $request->get('method'); - $transfer_enable = $request->get('transfer_enable'); - $protocol = $request->get('protocol'); - $protocol_param = $request->get('protocol_param'); - $obfs = $request->get('obfs'); - $obfs_param = $request->get('obfs_param'); - $content = $request->get('content'); + return Response::view('admin.articleList', $view); + } - if (empty($content)) { - return Response::json(['status' => 'fail', 'data' => '', 'message' => '请在左侧填入要转换的内容']); - } + // 添加文章 + public function addArticle(Request $request) + { + if ($request->isMethod('POST')) { + // LOGO + $logo = ''; + if ($request->hasFile('logo')) { + $file = $request->file('logo'); + $fileType = $file->getClientOriginalExtension(); + + // 验证文件合法性 + if (!in_array($fileType, ['jpg', 'png', 'jpeg', 'bmp'])) { + Session::flash('errorMsg', 'LOGO不合法'); + + return Redirect::back()->withInput(); + } - // 校验格式 - $content = json_decode($content); - if (empty($content->port_password)) { - return Response::json(['status' => 'fail', 'data' => '', 'message' => '转换失败:配置信息里缺少【port_password】字段,或者该字段为空']); + $logoName = date('YmdHis') . mt_rand(1000, 2000) . '.' . $fileType; + $move = $file->move(base_path() . '/public/upload/image/', $logoName); + $logo = $move ? '/upload/image/' . $logoName : ''; } - // 转换成SSR格式JSON - $data = []; - foreach ($content->port_password as $port => $passwd) { - $data[] = [ - 'd' => 0, - 'enable' => 1, - 'method' => $method, - 'obfs' => $obfs, - 'obfs_param' => empty($obfs_param) ? "" : $obfs_param, - 'passwd' => $passwd, - 'port' => $port, - 'protocol' => $protocol, - 'protocol_param' => empty($protocol_param) ? "" : $protocol_param, - 'transfer_enable' => $this->toGB($transfer_enable), - 'u' => 0, - 'user' => date('Ymd') . '_IMPORT_' . $port, - ]; + $article = new Article(); + $article->title = $request->get('title'); + $article->type = $request->get('type', 1); + $article->author = '管理员'; + $article->summary = $request->get('summary'); + $article->logo = $logo; + $article->content = $request->get('editorValue'); + $article->sort = $request->get('sort', 0); + $article->save(); + + if ($article->id) { + Session::flash('successMsg', '添加成功'); + } else { + Session::flash('errorMsg', '添加失败'); } - $json = json_encode($data); - - // 生成转换好的JSON文件 - file_put_contents(public_path('downloads/convert.json'), $json); - - return Response::json(['status' => 'success', 'data' => $json, 'message' => '转换成功']); + return Redirect::to('admin/articleList'); } else { - // 加密方式、协议、混淆 - $view['method_list'] = $this->methodList(); - $view['protocol_list'] = $this->protocolList(); - $view['obfs_list'] = $this->obfsList(); - - return Response::view('admin/convert', $view); + return Response::view('admin.addArticle'); } } - // 下载转换好的JSON文件 - public function download(Request $request) + // 编辑文章 + public function editArticle(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + $id = $request->get('id'); - if (!file_exists(public_path('downloads/convert.json'))) { - exit('文件不存在'); - } + if ($request->isMethod('POST')) { + $title = $request->get('title'); + $type = $request->get('type'); + $summary = $request->get('summary'); + $content = $request->get('editorValue'); + $sort = $request->get('sort'); - return Response::download(public_path('downloads/convert.json')); - } + // 商品LOGO + $logo = ''; + if ($request->hasFile('logo')) { + $file = $request->file('logo'); + $fileType = $file->getClientOriginalExtension(); - // 数据导入 - public function import(Request $request) - { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } + // 验证文件合法性 + if (!in_array($fileType, ['jpg', 'png', 'jpeg', 'bmp'])) { + Session::flash('errorMsg', 'LOGO不合法'); - if ($request->method() == 'POST') { + return Redirect::back()->withInput(); + } - if (!$request->hasFile('uploadFile')) { - $request->session()->flash('errorMsg', '请选择要上传的文件'); - return Redirect::back(); + $logoName = date('YmdHis') . mt_rand(1000, 2000) . '.' . $fileType; + $move = $file->move(base_path() . '/public/upload/image/', $logoName); + $logo = $move ? '/upload/image/' . $logoName : ''; } - $file = $request->file('uploadFile'); + $data = [ + 'type' => $type, + 'title' => $title, + 'summary' => $summary, + 'content' => $content, + 'sort' => $sort + ]; - // 只能上传JSON文件 - if ($file->getClientMimeType() != 'application/json' || $file->getClientOriginalExtension() != 'json') { - $request->session()->flash('errorMsg', '只允许上传JSON文件'); - return Redirect::back(); + if ($logo) { + $data['logo'] = $logo; } - if (!$file->isValid()) { - $request->session()->flash('errorMsg', '产生未知错误,请重新上传'); - return Redirect::back(); + $ret = Article::query()->where('id', $id)->update($data); + if ($ret) { + Session::flash('successMsg', '编辑成功'); + } else { + Session::flash('errorMsg', '编辑失败'); } - $save_path = realpath(storage_path('uploads')); - $new_name = md5($file->getClientOriginalExtension()).'json'; - $file->move($save_path, $new_name); + return Redirect::to('admin/editArticle?id=' . $id); + } else { + $view['article'] = Article::query()->where('id', $id)->first(); + + return Response::view('admin.editArticle', $view); + } + } + + // 删除文章 + public function delArticle(Request $request) + { + $id = $request->get('id'); + + $ret = Article::query()->where('id', $id)->delete(); + if ($ret) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败']); + } + } + + // 节点分组列表 + public function groupList(Request $request) + { + $view['groupList'] = SsGroup::query()->paginate(15)->appends($request->except('page')); + + $levelList = Helpers::levelList(); + $levelMap = []; + foreach ($levelList as $vo) { + $levelMap[$vo['level']] = $vo['level_name']; + } + $view['levelMap'] = $levelMap; + + return Response::view('admin.groupList', $view); + } + + // 添加节点分组 + public function addGroup(Request $request) + { + if ($request->isMethod('POST')) { + $ssGroup = new SsGroup(); + $ssGroup->name = $request->get('name'); + $ssGroup->level = $request->get('level'); + $ssGroup->save(); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']); + } else { + $view['levelList'] = Helpers::levelList(); + + return Response::view('admin.addGroup', $view); + } + } + + // 编辑节点分组 + public function editGroup(Request $request) + { + $id = $request->get('id'); + + if ($request->isMethod('POST')) { + $name = $request->get('name'); + $level = $request->get('level'); + + $data = [ + 'name' => $name, + 'level' => $level + ]; + + $ret = SsGroup::query()->where('id', $id)->update($data); + if ($ret) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '编辑成功']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '编辑失败']); + } + } else { + $view['group'] = SsGroup::query()->where('id', $id)->first(); + $view['levelList'] = Helpers::levelList(); + + return Response::view('admin.editGroup', $view); + } + } + + // 删除节点分组 + public function delGroup(Request $request) + { + $id = $request->get('id'); + + // 检查是否该分组下是否有节点 + $ssGroupNodeCount = SsGroupNode::query()->where('group_id', $id)->count(); + if ($ssGroupNodeCount) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败:该分组下有节点关联,请先解除关联']); + } + + $ret = SsGroup::query()->where('id', $id)->delete(); + if ($ret) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败']); + } + } + + // 流量日志 + public function trafficLog(Request $request) + { + $port = $request->get('port'); + $user_id = $request->get('user_id'); + $username = trim($request->get('username')); + $nodeId = intval($request->get('nodeId')); + + $query = UserTrafficLog::query()->with(['user', 'node']); + + if ($port) { + $query->whereHas('user', function ($q) use ($port) { + $q->where('port', $port); + }); + } + + if ($user_id) { + $query->where('user_id', intval($user_id)); + } + + if ($username) { + $query->whereHas('user', function ($q) use ($username) { + $q->where('username', 'like', '%' . $username . '%'); + }); + } + + if ($nodeId) { + $query->where('node_id', $nodeId); + } + + // 已使用流量 + $view['totalTraffic'] = flowAutoShow($query->sum('u') + $query->sum('d')); + + $list = $query->orderBy('id', 'desc')->paginate(20)->appends($request->except('page')); + foreach ($list as &$vo) { + $vo->u = flowAutoShow($vo->u); + $vo->d = flowAutoShow($vo->d); + $vo->log_time = date('Y-m-d H:i:s', $vo->log_time); + } + + $view['list'] = $list; + $view['nodeList'] = SsNode::query()->where('status', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->get(); + + return Response::view('admin.trafficLog', $view); + } + + // SS(R)链接反解析 + public function decompile(Request $request) + { + if ($request->isMethod('POST')) { + $content = $request->get('content'); + + if (empty($content)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '请在左侧填入要反解析的SS(R)链接']); + } + + // 反解析处理 + $content = str_replace("\n", ",", $content); + $content = explode(',', $content); + $txt = ''; + foreach ($content as $item) { + // 判断是SS还是SSR链接 + $str = ''; + if (false !== strpos($item, 'ssr://')) { + $str = mb_substr($item, 6); + } elseif (false !== strpos($item, 'ss://')) { + $str = mb_substr($item, 5); + } + + $txt .= "\r\n" . base64url_decode($str); + } + + // 生成转换好的JSON文件 + file_put_contents(public_path('downloads/decompile.json'), $txt); + + return Response::json(['status' => 'success', 'data' => $txt, 'message' => '反解析成功']); + } else { + return Response::view('admin.decompile'); + } + } + + // 格式转换(SS转SSR) + public function convert(Request $request) + { + if ($request->isMethod('POST')) { + $method = $request->get('method'); + $transfer_enable = $request->get('transfer_enable'); + $protocol = $request->get('protocol'); + $protocol_param = $request->get('protocol_param'); + $obfs = $request->get('obfs'); + $obfs_param = $request->get('obfs_param'); + $content = $request->get('content'); + + if (empty($content)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '请在左侧填入要转换的内容']); + } + + // 校验格式 + $content = json_decode($content); + if (empty($content->port_password)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '转换失败:配置信息里缺少【port_password】字段,或者该字段为空']); + } + + // 转换成SSR格式JSON + $data = []; + foreach ($content->port_password as $port => $passwd) { + $data[] = [ + 'd' => 0, + 'enable' => 1, + 'method' => $method, + 'obfs' => $obfs, + 'obfs_param' => empty($obfs_param) ? "" : $obfs_param, + 'passwd' => $passwd, + 'port' => $port, + 'protocol' => $protocol, + 'protocol_param' => empty($protocol_param) ? "" : $protocol_param, + 'transfer_enable' => toGB($transfer_enable), + 'u' => 0, + 'user' => date('Ymd') . '_IMPORT_' . $port, + ]; + } + + $json = json_encode($data); + + // 生成转换好的JSON文件 + file_put_contents(public_path('downloads/convert.json'), $json); + + return Response::json(['status' => 'success', 'data' => $json, 'message' => '转换成功']); + } else { + // 加密方式、协议、混淆 + $view['method_list'] = Helpers::methodList(); + $view['protocol_list'] = Helpers::protocolList(); + $view['obfs_list'] = Helpers::obfsList(); + + return Response::view('admin.convert', $view); + } + } + + // 下载转换好的JSON文件 + public function download(Request $request) + { + $type = $request->get('type'); + if (empty($type)) { + exit('参数异常'); + } + + if ($type == '1') { + $filePath = public_path('downloads/convert.json'); + } else { + $filePath = public_path('downloads/decompile.json'); + } + + if (!file_exists($filePath)) { + exit('文件不存在,请检查目录权限'); + } + + return Response::download($filePath); + } + + // 数据导入 + public function import(Request $request) + { + if ($request->isMethod('POST')) { + if (!$request->hasFile('uploadFile')) { + Session::flash('errorMsg', '请选择要上传的文件'); + + return Redirect::back(); + } + + $file = $request->file('uploadFile'); + + // 只能上传JSON文件 + if ($file->getClientMimeType() != 'application/json' || $file->getClientOriginalExtension() != 'json') { + Session::flash('errorMsg', '只允许上传JSON文件'); + + return Redirect::back(); + } + + if (!$file->isValid()) { + Session::flash('errorMsg', '产生未知错误,请重新上传'); + + return Redirect::back(); + } + + $save_path = realpath(storage_path('uploads')); + $new_name = md5($file->getClientOriginalExtension()) . '.json'; + $file->move($save_path, $new_name); + + // 读取文件内容 + $data = file_get_contents($save_path . '/' . $new_name); + $data = json_decode($data); + if (!$data) { + Session::flash('errorMsg', '内容格式解析异常,请上传符合SSR(R)配置规范的JSON文件'); - // 读取文件内容 - $data = file_get_contents($save_path.'/'.$new_name); - $data = json_decode($data); - if (!$data) { - $request->session()->flash('errorMsg', '内容格式解析异常,请上传符合SSR配置规范的JSON文件'); return Redirect::back(); } - \DB::beginTransaction(); + DB::beginTransaction(); try { foreach ($data as $user) { $obj = new User(); $obj->username = $user->user; - $obj->password = md5('123456'); + $obj->password = Hash::make('123456'); $obj->port = $user->port; $obj->passwd = $user->passwd; + $obj->vmess_id = $user->vmess_id; $obj->transfer_enable = $user->transfer_enable; $obj->u = 0; $obj->d = 0; $obj->t = 0; $obj->enable = 1; $obj->method = $user->method; - $obj->custom_method = $user->method; $obj->protocol = $user->protocol; $obj->protocol_param = $user->protocol_param; $obj->obfs = $user->obfs; @@ -582,114 +1334,280 @@ public function import(Request $request) $obj->expire_time = '2099-01-01'; $obj->remark = ''; $obj->is_admin = 0; - $obj->reg_ip = $request->getClientIp(); + $obj->reg_ip = getClientIp(); $obj->created_at = date('Y-m-d H:i:s'); $obj->updated_at = date('Y-m-d H:i:s'); $obj->save(); } - \DB::commit(); + DB::commit(); } catch (\Exception $e) { - \DB::rollBack(); + DB::rollBack(); + + Session::flash('errorMsg', '出错了,可能是导入的配置中有端口已经存在了'); - $request->session()->flash('errorMsg', '出错了,可能是导入的配置中有端口已经存在了'); return Redirect::back(); } + Session::flash('successMsg', '导入成功'); - $request->session()->flash('successMsg', '导入成功'); return Redirect::back(); } else { - return Response::view('admin/import'); + return Response::view('admin.import'); } } // 导出配置信息 public function export(Request $request) { - if (!$request->session()->has('user')) { - return Redirect::to('login'); - } - $id = $request->get('id'); + if (empty($id)) { return Redirect::to('admin/userList'); } - $user = User::where('id', $id)->first(); + $user = User::query()->where('id', $id)->first(); if (empty($user)) { return Redirect::to('admin/userList'); } - $nodeList = SsNode::paginate(10); + $nodeList = SsNode::query()->where('status', 1)->orderBy('sort', 'desc')->orderBy('id', 'asc')->paginate(15)->appends($request->except('page')); foreach ($nodeList as &$node) { - // 生成scheme - $str = ''; - $str .= $node->server . ':' . $user->port; - $str .= ':' . $user->protocol . ':' . $user->method; - $str .= ':' . $user->obfs . ':' . base64_encode($user->passwd); - $str .= '/?obfsparam=' . $user->obfs_param; - $str .= '&=protoparam' . $user->protocol_param; - $str .= '&remarks=' . base64_encode('VPN'); - $str = $this->base64url_encode($str); - $scheme = 'ssr://' . $str; - - // 生成json配置信息 - $config = <<"; + echo "使用方法:"; + echo ""; + exit(); + } + + // 验证TOKEN,防止滥用 + if (env('API_TOKEN') != $token) { + return response()->json(['status' => 0, 'message' => 'token invalid']); + } + + // 如果不是IPv4 + if (false === filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + // 如果是IPv6 + if (filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + $host = '[' . $host . ']'; + } + } + + try { + $host = gethostbyname($host); // 这里如果挂了,说明服务器的DNS解析不给力,必须换 + $fp = stream_socket_client($transport . '://' . $host . ':' . $port, $errno, $errstr, $timeout); + if (!$fp) { + Log::info("$errstr ($errno)"); + $ret = 0; + $message = 'port close'; + } else { + $ret = 1; + $message = 'port open'; + } + + fclose($fp); + + return response()->json(['status' => $ret, 'message' => $message]); + } catch (\Exception $e) { + Log::info($e); + + return response()->json(['status' => 0, 'message' => 'port close']); + } + } +} diff --git a/app/Http/Controllers/Api/YzyController.php b/app/Http/Controllers/Api/YzyController.php new file mode 100644 index 000000000..e453119bb --- /dev/null +++ b/app/Http/Controllers/Api/YzyController.php @@ -0,0 +1,393 @@ +all(), true) . '[' . getClientIp() . ']'); + exit("【有赞云】接口正常"); + } + + // 接收POST请求 + public function store(Request $request) + { + \Log::info("【有赞云】回调接口[POST]:" . var_export($request->all(), true)); + + $json = file_get_contents('php://input'); + $data = json_decode($json, true); + if (!$data) { + Log::info('YZY-POST:回调数据无法解析,可能是非法请求[' . getClientIp() . ']'); + exit(); + } + + // 判断消息是否合法 + $msg = $data['msg']; + $sign_string = self::$systemConfig['youzan_client_id'] . "" . $msg . "" . self::$systemConfig['youzan_client_secret']; + $sign = md5($sign_string); + if ($sign != $data['sign']) { + Log::info('本地签名:' . $sign_string . ' | 远程签名:' . $data['sign']); + Log::info('YZY-POST:回调数据签名错误,可能是非法请求[' . getClientIp() . ']'); + exit(); + } else { + // 返回请求成功标识给有赞 + var_dump(["code" => 0, "msg" => "success"]); + } + + // 容错 + if (!isset($data['kdt_name'])) { + Log::info("【有赞云】回调数据解析错误,请检查有赞支付设置是否与有赞控制台中的信息保持一致。如果还出现此提示,请执行一遍php artisan cache:clear命令"); + exit(); + } + + // 先写入回调日志 + $this->callbackLog($data['client_id'], $data['id'], $data['kdt_id'], $data['kdt_name'], $data['mode'], $data['msg'], $data['sendCount'], $data['sign'], $data['status'], $data['test'], $data['type'], $data['version']); + + // msg内容经过 urlencode 编码,进行解码 + $msg = json_decode(urldecode($msg), true); + + switch ($data['type']) { + case 'trade_TradePaid': + $this->tradePaid($msg); + break; + case 'trade_TradeCreate': + $this->tradeCreate($msg); + break; + case 'trade_TradeClose': + $this->tradeClose($msg); + break; + case 'trade_TradeSuccess': + $this->tradeSuccess($msg); + break; + case 'trade_TradePartlySellerShip': + $this->tradePartlySellerShip($msg); + break; + case 'trade_TradeSellerShip': + $this->tradeSellerShip($msg); + break; + case 'trade_TradeBuyerPay': + $this->tradeBuyerPay($msg); + break; + case 'trade_TradeMemoModified': + $this->tradeMemoModified($msg); + break; + default: + Log::info('【有赞云】回调无法识别,可能是没有启用[交易消息V3]接口,请到有赞云控制台启用消息推送服务'); + exit(); + } + + exit(); + } + + // 交易支付 + private function tradePaid($msg) + { + Log::info('【有赞云】回调交易支付'); + + $payment = Payment::query()->with(['order', 'order.goods'])->where('qr_id', $msg['qr_info']['qr_id'])->first(); + if (!$payment) { + Log::info('【有赞云】回调订单不存在'); + exit(); + } + + if ($payment->status != '0') { + Log::info('【有赞云】回调订单状态不正确'); + exit(); + } + + // 处理订单 + DB::beginTransaction(); + try { + // 如果支付单中没有用户信息则创建一个用户 + if (!$payment->user_id) { + // 生成一个可用端口 + $port = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + + $user = new User(); + $user->username = '自动生成-' . $payment->order->email; + $user->password = Hash::make(makeRandStr()); + $user->port = $port; + $user->passwd = makeRandStr(); + $user->vmess_id = createGuid(); + $user->enable = 1; + $user->method = Helpers::getDefaultMethod(); + $user->protocol = Helpers::getDefaultProtocol(); + $user->obfs = Helpers::getDefaultObfs(); + $user->usage = 1; + $user->transfer_enable = 1; // 新创建的账号给1,防止定时任务执行时发现u + d >= transfer_enable被判为流量超限而封禁 + $user->enable_time = date('Y-m-d'); + $user->expire_time = date('Y-m-d', strtotime("+" . $payment->order->goods->days . " days")); + $user->reg_ip = getClientIp(); + $user->referral_uid = 0; + $user->traffic_reset_day = 0; + $user->status = 1; + $user->save(); + + if ($user->id) { + Order::query()->where('oid', $payment->oid)->update(['user_id' => $user->id]); + } + } + + // 更新支付单 + $payment->pay_way = $msg['full_order_info']['order_info']['pay_type_str'] == 'WEIXIN_DAIXIAO' ? 1 : 2; // 1-微信、2-支付宝 + $payment->status = 1; + $payment->save(); + + // 更新订单 + $order = Order::query()->with(['user'])->where('oid', $payment->oid)->first(); + $order->status = 2; + $order->save(); + + $goods = Goods::query()->where('id', $order->goods_id)->first(); + + // 商品为流量或者套餐 + if ($goods->type <= 2) { + // 如果买的是套餐,则先将之前购买的所有套餐置都无效,并扣掉之前所有套餐的流量,重置用户已用流量为0 + if ($goods->type == 2) { + $existOrderList = Order::query() + ->with(['goods']) + ->whereHas('goods', function ($q) { + $q->where('type', 2); + }) + ->where('user_id', $order->user_id) + ->where('oid', '<>', $order->oid) + ->where('is_expire', 0) + ->where('status', 2) + ->get(); + + foreach ($existOrderList as $vo) { + Order::query()->where('oid', $vo->oid)->update(['is_expire' => 1]); + + // 先判断,防止手动扣减过流量的用户流量被扣成负数 + if ($order->user->transfer_enable - $vo->goods->traffic * 1048576 <= 0) { + // 写入用户流量变动记录 + Helpers::addUserTrafficModifyLog($order->user_id, $order->oid, 0, 0, '[在线支付]用户购买套餐,先扣减之前套餐的流量(扣完)'); + + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0, 'transfer_enable' => 0]); + } else { + // 写入用户流量变动记录 + $user = User::query()->where('id', $order->user_id)->first(); // 重新取出user信息 + Helpers::addUserTrafficModifyLog($order->user_id, $order->oid, $user->transfer_enable, ($user->transfer_enable - $vo->goods->traffic * 1048576), '[在线支付]用户购买套餐,先扣减之前套餐的流量(未扣完)'); + + User::query()->where('id', $order->user_id)->update(['u' => 0, 'd' => 0]); + User::query()->where('id', $order->user_id)->decrement('transfer_enable', $vo->goods->traffic * 1048576); + } + } + } + + // 写入用户流量变动记录 + $user = User::query()->where('id', $order->user_id)->first(); // 重新取出user信息 + Helpers::addUserTrafficModifyLog($order->user_id, $order->oid, $user->transfer_enable, ($user->transfer_enable + $goods->traffic * 1048576), '[在线支付]用户购买商品,加上流量'); + + // 计算账号过期时间 + if ($order->user->expire_time < date('Y-m-d', strtotime("+" . $goods->days . " days"))) { + $expireTime = date('Y-m-d', strtotime("+" . $goods->days . " days")); + } else { + $expireTime = $order->user->expire_time; + } + + // 把商品的流量加到账号上 + User::query()->where('id', $order->user_id)->increment('transfer_enable', $goods->traffic * 1048576); + + // 套餐就改流量重置日,流量包不改 + if ($goods->type == 2) { + if (date('m') == 2 && date('d') == 29) { + $traffic_reset_day = 28; + } else { + $traffic_reset_day = date('d') == 31 ? 30 : abs(date('d')); + } + User::query()->where('id', $order->user_id)->update(['traffic_reset_day' => $traffic_reset_day, 'expire_time' => $expireTime, 'enable' => 1]); + } else { + User::query()->where('id', $order->user_id)->update(['expire_time' => $expireTime, 'enable' => 1]); + } + + // 写入用户标签 + if ($goods->label) { + // 用户默认标签 + $defaultLabels = []; + if (self::$systemConfig['initial_labels_for_user']) { + $defaultLabels = explode(',', self::$systemConfig['initial_labels_for_user']); + } + + // 取出现有的标签 + $userLabels = UserLabel::query()->where('user_id', $order->user_id)->pluck('label_id')->toArray(); + $goodsLabels = GoodsLabel::query()->where('goods_id', $order->goods_id)->pluck('label_id')->toArray(); + + // 标签去重 + $newUserLabels = array_values(array_unique(array_merge($userLabels, $goodsLabels, $defaultLabels))); + + // 删除用户所有标签 + UserLabel::query()->where('user_id', $order->user_id)->delete(); + + // 生成标签 + foreach ($newUserLabels as $vo) { + $obj = new UserLabel(); + $obj->user_id = $order->user_id; + $obj->label_id = $vo; + $obj->save(); + } + } + + // 写入返利日志 + if ($order->user->referral_uid) { + $this->addReferralLog($order->user_id, $order->user->referral_uid, $order->oid, $order->amount, $order->amount * self::$systemConfig['referral_percent']); + } + + // 取消重复返利 + User::query()->where('id', $order->user_id)->update(['referral_uid' => 0]); + } elseif ($goods->type == 3) { // 商品为在线充值 + User::query()->where('id', $order->user_id)->increment('balance', $goods->price * 100); + + // 余额变动记录日志 + $this->addUserBalanceLog($order->user_id, $order->oid, $order->user->balance, $order->user->balance + $goods->price, $goods->price, '用户在线充值'); + } + + // 自动提号机:如果order的email值不为空 + if ($order->email) { + $title = '自动发送账号信息'; + $content = [ + 'order_sn' => $order->order_sn, + 'goods_name' => $order->goods->name, + 'goods_traffic' => flowAutoShow($order->goods->traffic * 1048576), + 'port' => $order->user->port, + 'passwd' => $order->user->passwd, + 'method' => $order->user->method, + //'protocol' => $order->user->protocol, + //'protocol_param' => $order->user->protocol_param, + //'obfs' => $order->user->obfs, + //'obfs_param' => $order->user->obfs_param, + 'created_at' => $order->created_at->toDateTimeString(), + 'expire_at' => $order->expire_at + ]; + + // 获取可用节点列表 + $labels = UserLabel::query()->where('user_id', $order->user_id)->get()->pluck('label_id'); + $nodeIds = SsNodeLabel::query()->whereIn('label_id', $labels)->get()->pluck('node_id'); + $nodeList = SsNode::query()->whereIn('id', $nodeIds)->orderBy('sort', 'desc')->orderBy('id', 'desc')->get()->toArray(); + $content['serverList'] = $nodeList; + + $logId = Helpers::addEmailLog($order->email, $title, json_encode($content)); + Mail::to($order->email)->send(new sendUserInfo($logId, $content)); + } + + DB::commit(); + } catch (\Exception $e) { + DB::rollBack(); + + Log::info('【有赞云】回调更新支付单和订单异常:' . $e->getMessage()); + } + + exit(); + } + + // 创建交易 + private function tradeCreate($msg) + { + Log::info('【有赞云】回调创建交易'); + exit(); + } + + // 关闭交易(无视,系统自带15分钟自动关闭未支付订单的定时任务) + private function tradeClose($msg) + { + Log::info('【有赞云】回调关闭交易'); + + exit(); + } + + // 交易成功 + private function tradeSuccess($msg) + { + Log::info('【有赞云】回调交易成功'); + + exit(); + } + + // 卖家部分发货 + private function tradePartlySellerShip($msg) + { + Log::info('【有赞云】回调卖家部分发货'); + exit(); + } + + // 卖家发货 + private function tradeSellerShip($msg) + { + Log::info('【有赞云】回调卖家发货'); + exit(); + } + + // 买家付款 + private function tradeBuyerPay($msg) + { + Log::info('【有赞云】回调买家付款'); + exit(); + } + + // 卖家修改交易备注 + private function tradeMemoModified($msg) + { + Log::info('【有赞云】回调卖家修改交易备注'); + exit(); + } + + public function show(Request $request) + { + exit('show'); + } + + // 写入回调请求日志 + private function callbackLog($client_id, $yz_id, $kdt_id, $kdt_name, $mode, $msg, $sendCount, $sign, $status, $test, $type, $version) + { + $obj = new PaymentCallback(); + $obj->client_id = $client_id; + $obj->yz_id = $yz_id; + $obj->kdt_id = $kdt_id; + $obj->kdt_name = $kdt_name; + $obj->mode = $mode; + $obj->msg = urldecode($msg); + $obj->sendCount = $sendCount; + $obj->sign = $sign; + $obj->status = $status; + $obj->test = $test; + $obj->type = $type; + $obj->version = $version; + $obj->save(); + + return $obj->id; + } +} diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php deleted file mode 100644 index 6a247fefd..000000000 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ /dev/null @@ -1,32 +0,0 @@ -middleware('guest'); - } -} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php deleted file mode 100644 index b2ea669a0..000000000 --- a/app/Http/Controllers/Auth/LoginController.php +++ /dev/null @@ -1,39 +0,0 @@ -middleware('guest')->except('logout'); - } -} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php deleted file mode 100644 index ed8d1b774..000000000 --- a/app/Http/Controllers/Auth/RegisterController.php +++ /dev/null @@ -1,71 +0,0 @@ -middleware('guest'); - } - - /** - * Get a validator for an incoming registration request. - * - * @param array $data - * @return \Illuminate\Contracts\Validation\Validator - */ - protected function validator(array $data) - { - return Validator::make($data, [ - 'name' => 'required|string|max:255', - 'email' => 'required|string|email|max:255|unique:users', - 'password' => 'required|string|min:6|confirmed', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @param array $data - * @return User - */ - protected function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } -} diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php deleted file mode 100644 index cf726eecd..000000000 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ /dev/null @@ -1,39 +0,0 @@ -middleware('guest'); - } -} diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php new file mode 100644 index 000000000..6d466bc23 --- /dev/null +++ b/app/Http/Controllers/AuthController.php @@ -0,0 +1,766 @@ +isMethod('POST')) { + $this->validate($request, [ + 'username' => 'required', + 'password' => 'required' + ], [ + 'username.required' => '请输入用户名', + 'password.required' => '请输入密码' + ]); + + // 是否校验验证码 + switch (self::$systemConfig['is_captcha']) { + case 1: // 默认图形验证码 + if (!Captcha::check($request->captcha)) { + return Redirect::back()->withInput()->withErrors('验证码错误,请重新输入'); + } + break; + case 2: // Geetest + $result = $this->validate($request, [ + 'geetest_challenge' => 'required|geetest' + ], [ + 'geetest' => trans('login.fail_captcha') + ]); + + if (!$result) { + return Redirect::back()->withInput()->withErrors(trans('login.fail_captcha')); + } + break; + case 3: // Google reCAPTCHA + $result = $this->validate($request, [ + 'g-recaptcha-response' => 'required|NoCaptcha' + ]); + + if (!$result) { + return Redirect::back()->withInput()->withErrors(trans('login.fail_captcha')); + } + break; + default: // 不启用验证码 + break; + } + + // 验证账号并创建会话 + if (!Auth::attempt(['username' => $request->username, 'password' => $request->password], $request->remember)) { + return Redirect::back()->withInput()->withErrors('用户名或密码错误'); + } + + // 校验普通用户账号状态 + if (!Auth::user()->is_admin) { + if (Auth::user()->status < 0) { + Auth::logout(); // 强制销毁会话,因为Auth::attempt的时候会产生会话 + + return Redirect::back()->withInput()->withErrors('账号已禁用'); + } + + if (Auth::user()->status == 0 && self::$systemConfig['is_active_register']) { + Auth::logout(); // 强制销毁会话,因为Auth::attempt的时候会产生会话 + + return Redirect::back()->withInput()->withErrors('账号未激活,请点击【激活账号】'); + } + } + + // 写入登录日志 + $this->addUserLoginLog(Auth::user()->id, getClientIp()); + + // 更新登录信息 + User::uid()->update(['last_login' => time()]); + + // 根据权限跳转 + if (Auth::user()->is_admin) { + return Redirect::to('admin'); + } + + return Redirect::to('/'); + } else { + if (Auth::check()) { + if (Auth::user()->is_admin) { + return Redirect::to('admin'); + } + + return Redirect::to('/'); + } + + return Response::view('auth.login'); + } + } + + // 退出 + public function logout(Request $request) + { + Auth::logout(); + + return Redirect::to('login'); + } + + // 注册 + public function register(Request $request) + { + $cacheKey = 'register_times_' . md5(getClientIp()); // 注册限制缓存key + + if ($request->isMethod('POST')) { + $this->validate($request, [ + 'username' => 'required|email|unique:user', + 'password' => 'required|min:6', + 'repassword' => 'required|same:password', + ], [ + 'username.required' => '请输入用户名', + 'username.email' => '用户名必须是合法邮箱', + 'username.unique' => '用户已存在,如果忘记密码请找回密码', + 'password.required' => '请输入密码', + 'password.min' => '密码最少要6位数', + 'repassword.required' => '请再次输入密码', + 'repassword.same' => '两次输入密码不一致' + ]); + + // 防止重复提交 + if ($request->register_token != Session::get('register_token')) { + return Redirect::back()->withInput()->withErrors('请勿重复请求,刷新一下页面再试试'); + } else { + Session::forget('register_token'); + } + + // 是否开启注册 + if (!self::$systemConfig['is_register']) { + return Redirect::back()->withErrors('系统维护,暂停注册'); + } + + // 校验域名邮箱是否在敏感词中 + $sensitiveWords = $this->sensitiveWords(); + $usernameSuffix = explode('@', $request->username); // 提取邮箱后缀 + if (in_array(strtolower($usernameSuffix[1]), $sensitiveWords)) { + return Redirect::back()->withInput()->withErrors('邮箱含有敏感词,请重新输入'); + } + + // 如果需要邀请注册 + if (self::$systemConfig['is_invite_register']) { + // 必须使用邀请码 + if (self::$systemConfig['is_invite_register'] == 2 && !$request->code) { + return Redirect::back()->withInput()->withErrors('请输入邀请码'); + } + + // 校验邀请码合法性 + if ($request->code) { + $codeEnable = Invite::query()->where('code', $request->code)->where('status', 0)->first(); + if (!$codeEnable) { + return Redirect::back()->withInput($request->except(['code']))->withErrors('邀请码不可用,请重试'); + } + } + } + + // 如果开启注册发送验证码 + if (self::$systemConfig['is_verify_register']) { + if (!$request->verify_code) { + return Redirect::back()->withInput($request->except(['verify_code']))->withErrors('请输入验证码'); + } else { + $verifyCode = VerifyCode::query()->where('username', $request->username)->where('code', $request->verify_code)->where('status', 0)->first(); + if (!$verifyCode) { + return Redirect::back()->withInput($request->except(['verify_code']))->withErrors('验证码不合法,可能已过期,请重试'); + } + + $verifyCode->status = 1; + $verifyCode->save(); + } + } elseif (self::$systemConfig['is_captcha']) { // 是否校验验证码 + switch (self::$systemConfig['is_captcha']) { + case 1: // 默认图形验证码 + if (!Captcha::check($request->captcha)) { + return Redirect::back()->withInput()->withErrors('验证码错误,请重新输入'); + } + break; + case 2: // Geetest + $result = $this->validate($request, [ + 'geetest_challenge' => 'required|geetest' + ], [ + 'geetest' => trans('login.fail_captcha') + ]); + + if (!$result) { + return Redirect::back()->withInput()->withErrors(trans('login.fail_captcha')); + } + break; + case 3: // Google reCAPTCHA + $result = $this->validate($request, [ + 'g-recaptcha-response' => 'required|NoCaptcha' + ]); + + if (!$result) { + return Redirect::back()->withInput()->withErrors(trans('login.fail_captcha')); + } + break; + default: // 不启用验证码 + break; + } + } + + // 24小时内同IP注册限制 + if (self::$systemConfig['register_ip_limit']) { + if (Cache::has($cacheKey)) { + $registerTimes = Cache::get($cacheKey); + if ($registerTimes >= self::$systemConfig['register_ip_limit']) { + return Redirect::back()->withInput($request->except(['code']))->withErrors('系统已开启防刷机制,请勿频繁注册'); + } + } + } + + // 获取可用端口 + $port = self::$systemConfig['is_rand_port'] ? Helpers::getRandPort() : Helpers::getOnlyPort(); + if ($port > self::$systemConfig['max_port']) { + return Redirect::back()->withInput()->withErrors('系统不再接受新用户,请联系管理员'); + } + + // 获取aff + $affArr = $this->getAff($request->code, intval($request->aff)); + $referral_uid = $affArr['referral_uid']; + + $transfer_enable = $referral_uid ? (self::$systemConfig['default_traffic'] + self::$systemConfig['referral_traffic']) * 1048576 : self::$systemConfig['default_traffic'] * 1048576; + + // 创建新用户 + $user = new User(); + $user->username = $request->username; + $user->password = Hash::make($request->password); + $user->port = $port; + $user->passwd = makeRandStr(); + $user->vmess_id = createGuid(); + $user->transfer_enable = $transfer_enable; + $user->method = Helpers::getDefaultMethod(); + $user->protocol = Helpers::getDefaultProtocol(); + $user->obfs = Helpers::getDefaultObfs(); + $user->enable_time = date('Y-m-d H:i:s'); + $user->expire_time = date('Y-m-d H:i:s', strtotime("+" . self::$systemConfig['default_days'] . " days")); + $user->reg_ip = getClientIp(); + $user->referral_uid = $referral_uid; + $user->save(); + + // 注册失败,抛出异常 + if (!$user->id) { + return Redirect::back()->withInput()->withErrors('注册失败,请联系管理员'); + } + + // 生成订阅码 + $subscribe = new UserSubscribe(); + $subscribe->user_id = $user->id; + $subscribe->code = Helpers::makeSubscribeCode(); + $subscribe->times = 0; + $subscribe->save(); + + // 注册次数+1 + if (Cache::has($cacheKey)) { + Cache::increment($cacheKey); + } else { + Cache::put($cacheKey, 1, 1440); // 24小时 + } + + // 初始化默认标签 + if (strlen(self::$systemConfig['initial_labels_for_user'])) { + $labels = explode(',', self::$systemConfig['initial_labels_for_user']); + foreach ($labels as $label) { + $userLabel = new UserLabel(); + $userLabel->user_id = $user->id; + $userLabel->label_id = $label; + $userLabel->save(); + } + } + + // 更新邀请码 + if (self::$systemConfig['is_invite_register'] && $affArr['code_id']) { + Invite::query()->where('id', $affArr['code_id'])->update(['fuid' => $user->id, 'status' => 1]); + } + + // 清除邀请人Cookie + \Cookie::unqueue('register_aff'); + + if (self::$systemConfig['is_verify_register']) { + if ($referral_uid) { + $transfer_enable = self::$systemConfig['referral_traffic'] * 1048576; + + User::query()->where('id', $referral_uid)->increment('transfer_enable', $transfer_enable); + User::query()->where('id', $referral_uid)->update(['status' => 1, 'enable' => 1]); + } + + User::query()->where('id', $user->id)->update(['status' => 1, 'enable' => 1]); + + Session::flash('regSuccessMsg', '注册成功'); + } else { + // 发送激活邮件 + if (self::$systemConfig['is_active_register']) { + // 生成激活账号的地址 + $token = md5(self::$systemConfig['website_name'] . $request->username . microtime()); + $activeUserUrl = self::$systemConfig['website_url'] . '/active/' . $token; + $this->addVerify($user->id, $token); + + $logId = Helpers::addEmailLog($request->username, '注册激活', '请求地址:' . $activeUserUrl); + Mail::to($request->username)->send(new activeUser($logId, $activeUserUrl)); + + Session::flash('regSuccessMsg', '注册成功:激活邮件已发送,如未收到,请查看垃圾邮箱'); + } else { + // 如果不需要激活,则直接给推荐人加流量 + if ($referral_uid) { + $transfer_enable = self::$systemConfig['referral_traffic'] * 1048576; + + User::query()->where('id', $referral_uid)->increment('transfer_enable', $transfer_enable); + User::query()->where('id', $referral_uid)->update(['status' => 1, 'enable' => 1]); + } + + User::query()->where('id', $user->id)->update(['status' => 1, 'enable' => 1]); + + Session::flash('regSuccessMsg', '注册成功'); + } + } + + return Redirect::to('login')->withInput(); + } else { + Session::put('register_token', makeRandStr(16)); + + return Response::view('auth.register'); + } + } + + // 重设密码页 + public function resetPassword(Request $request) + { + if ($request->isMethod('POST')) { + // 校验请求 + $this->validate($request, [ + 'username' => 'required|email' + ], [ + 'username.required' => '请输入用户名', + 'username.email' => '用户名必须是合法邮箱' + ]); + + // 是否开启重设密码 + if (!self::$systemConfig['is_reset_password']) { + return Redirect::back()->withErrors('系统未开启重置密码功能,请联系管理员'); + } + + // 查找账号 + $user = User::query()->where('username', $request->username)->first(); + if (!$user) { + return Redirect::back()->withErrors('账号不存在,请重试'); + } + + // 24小时内重设密码次数限制 + $resetTimes = 0; + if (Cache::has('resetPassword_' . md5($request->username))) { + $resetTimes = Cache::get('resetPassword_' . md5($request->username)); + if ($resetTimes >= self::$systemConfig['reset_password_times']) { + return Redirect::back()->withErrors('同一个账号24小时内只能重设密码' . self::$systemConfig['reset_password_times'] . '次,请勿频繁操作'); + } + } + + // 生成取回密码的地址 + $token = md5(self::$systemConfig['website_name'] . $request->username . microtime()); + $verify = new Verify(); + $verify->type = 1; + $verify->user_id = $user->id; + $verify->token = $token; + $verify->status = 0; + $verify->save(); + + // 发送邮件 + $resetPasswordUrl = self::$systemConfig['website_url'] . '/reset/' . $token; + + $logId = Helpers::addEmailLog($request->username, '重置密码', '请求地址:' . $resetPasswordUrl); + Mail::to($request->username)->send(new resetPassword($logId, $resetPasswordUrl)); + + Cache::put('resetPassword_' . md5($request->username), $resetTimes + 1, 1440); + + return Redirect::back()->with('successMsg', '重置成功,请查看邮箱'); + } else { + return Response::view('auth.resetPassword'); + } + } + + // 重设密码 + public function reset(Request $request, $token) + { + if (!$token) { + return Redirect::to('login'); + } + + if ($request->isMethod('POST')) { + $this->validate($request, [ + 'password' => 'required|min:6', + 'repassword' => 'required|same:password' + ], [ + 'password.required' => '密码不能为空', + 'password.min' => '密码最少要6位数', + 'repassword.required' => '密码不能为空', + 'repassword.min' => '密码最少要6位数', + 'repassword.same' => '两次输入密码不一致', + ]); + + // 校验账号 + $verify = Verify::type(1)->with('user')->where('token', $token)->first(); + if (!$verify) { + return Redirect::to('login'); + } elseif ($verify->status == 1) { + return Redirect::back()->withErrors('该链接已失效'); + } elseif ($verify->user->status < 0) { + return Redirect::back()->withErrors('账号已被禁用'); + } elseif (Hash::check($request->password, $verify->user->password)) { + return Redirect::back()->withErrors('新旧密码一样,请重新输入'); + } + + // 更新密码 + $ret = User::query()->where('id', $verify->user_id)->update(['password' => Hash::make($request->password)]); + if (!$ret) { + return Redirect::back()->withErrors('重设密码失败'); + } + + // 置为已使用 + $verify->status = 1; + $verify->save(); + + return Redirect::back()->with('successMsg', '新密码设置成功,请自行登录'); + } else { + $verify = Verify::type(1)->where('token', $token)->first(); + if (!$verify) { + return Redirect::to('login'); + } elseif (time() - strtotime($verify->created_at) >= 1800) { + // 置为已失效 + $verify->status = 2; + $verify->save(); + } + + // 重新获取一遍verify + $view['verify'] = Verify::type(1)->where('token', $token)->first(); + + return Response::view('auth.reset', $view); + } + } + + // 激活账号页 + public function activeUser(Request $request) + { + if ($request->isMethod('POST')) { + $this->validate($request, [ + 'username' => 'required|email|exists:user,username' + ], [ + 'username.required' => '请输入用户名', + 'username.email' => '用户名必须是合法邮箱', + 'username.exists' => '账号不存在,请重试' + ]); + + // 是否开启账号激活 + if (!self::$systemConfig['is_active_register']) { + return Redirect::back()->withInput()->withErrors('系统未开启账号激活功能,请联系管理员'); + } + + // 查找账号 + $user = User::query()->where('username', $request->username)->first(); + if ($user->status < 0) { + return Redirect::back()->withErrors('账号已封禁,请联系管理员'); + } elseif ($user->status > 0) { + return Redirect::back()->withErrors('账号状态正常,无需激活'); + } + + // 24小时内激活次数限制 + $activeTimes = 0; + if (Cache::has('activeUser_' . md5($request->username))) { + $activeTimes = Cache::get('activeUser_' . md5($request->username)); + if ($activeTimes >= self::$systemConfig['active_times']) { + return Redirect::back()->withErrors('同一个账号24小时内只能请求激活' . self::$systemConfig['active_times'] . '次,请勿频繁操作'); + } + } + + // 生成激活账号的地址 + $token = md5(self::$systemConfig['website_name'] . $request->username . microtime()); + $verify = new Verify(); + $verify->type = 1; + $verify->user_id = $user->id; + $verify->token = $token; + $verify->status = 0; + $verify->save(); + + // 发送邮件 + $activeUserUrl = self::$systemConfig['website_url'] . '/active/' . $token; + + $logId = Helpers::addEmailLog($request->username, '激活账号', '请求地址:' . $activeUserUrl); + Mail::to($request->username)->send(new activeUser($logId, $activeUserUrl)); + + Cache::put('activeUser_' . md5($request->username), $activeTimes + 1, 1440); + + return Redirect::back()->with('successMsg', '激活邮件已发送,如未收到,请查看垃圾箱'); + } else { + return Response::view('auth.activeUser'); + } + } + + // 激活账号 + public function active(Request $request, $token) + { + if (!$token) { + return Redirect::to('login'); + } + + $verify = Verify::type(1)->with('user')->where('token', $token)->first(); + if (!$verify) { + return Redirect::to('login'); + } elseif (empty($verify->user)) { + Session::flash('errorMsg', '该链接已失效'); + + return Response::view('auth.active'); + } elseif ($verify->status > 0) { + Session::flash('errorMsg', '该链接已失效'); + + return Response::view('auth.active'); + } elseif ($verify->user->status != 0) { + Session::flash('errorMsg', '该账号无需激活.'); + + return Response::view('auth.active'); + } elseif (time() - strtotime($verify->created_at) >= 1800) { + Session::flash('errorMsg', '该链接已过期'); + + // 置为已失效 + $verify->status = 2; + $verify->save(); + + return Response::view('auth.active'); + } + + // 更新账号状态 + $ret = User::query()->where('id', $verify->user_id)->update(['status' => 1]); + if (!$ret) { + Session::flash('errorMsg', '账号激活失败'); + + return Redirect::back(); + } + + // 置为已使用 + $verify->status = 1; + $verify->save(); + + // 账号激活后给邀请人送流量 + if ($verify->user->referral_uid) { + $transfer_enable = self::$systemConfig['referral_traffic'] * 1048576; + + User::query()->where('id', $verify->user->referral_uid)->increment('transfer_enable', $transfer_enable); + User::query()->where('id', $verify->user->referral_uid)->update(['enable' => 1]); + } + + Session::flash('successMsg', '账号激活成功'); + + return Response::view('auth.active'); + } + + // 发送注册验证码 + public function sendCode(Request $request) + { + $validator = Validator::make($request->all(), [ + 'username' => 'required|email|unique:user' + ], [ + 'username.required' => '请填入邮箱', + 'username.email' => '邮箱地址不合法,请重新输入', + 'username.unique' => '用户已存在,如果忘记密码请找回密码' + ]); + + if ($validator->fails()) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => $validator->getMessageBag()->first()]); + } + + // 校验域名邮箱是否在敏感词中 + $sensitiveWords = $this->sensitiveWords(); + $usernameSuffix = explode('@', $request->username); // 提取邮箱后缀 + if (in_array(strtolower($usernameSuffix[1]), $sensitiveWords)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '邮箱含有敏感词,请重新输入']); + } + + // 是否开启注册发送验证码 + if (!self::$systemConfig['is_verify_register']) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '系统未启用通过验证码注册']); + } + + // 防刷机制 + if (Cache::has('send_verify_code_' . md5(getClientIP()))) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '系统已开启防刷机制,请勿频繁请求']); + } + + // 发送邮件 + $code = makeRandStr(6, true); + $logId = Helpers::addEmailLog($request->username, '发送注册验证码', '验证码:' . $code); + Mail::to($request->username)->send(new sendVerifyCode($logId, $code)); + + $this->addVerifyCode($request->username, $code); + + Cache::put('send_verify_code_' . md5(getClientIP()), getClientIP(), 1); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '验证码已发送']); + } + + // 公开的邀请码列表 + public function free(Request $request) + { + $view['inviteList'] = Invite::query()->where('uid', 0)->where('status', 0)->paginate(); + + return Response::view('auth.free', $view); + } + + // 切换语言 + public function switchLang(Request $request, $locale) + { + Session::put("locale", $locale); + + return Redirect::back(); + } + + /** + * 添加用户登录日志 + * + * @param string $userId 用户ID + * @param string $ip IP地址 + */ + private function addUserLoginLog($userId, $ip) + { + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + Log::info('识别到IPv6,尝试解析:' . $ip); + $ipInfo = getIPv6($ip); + } else { + $ipInfo = QQWry::ip($ip); // 通过纯真IP库解析IPv4信息 + if (isset($ipInfo['error'])) { + Log::info('无法识别IPv4,尝试使用IPIP的IP库解析:' . $ip); + $ipip = IPIP::ip($ip); + $ipInfo = [ + 'country' => $ipip['country_name'], + 'province' => $ipip['region_name'], + 'city' => $ipip['city_name'] + ]; + } else { + // 判断纯真IP库获取的国家信息是否与IPIP的IP库获取的信息一致,不一致则用IPIP的(因为纯真IP库的非大陆IP准确率较低) + $ipip = IPIP::ip($ip); + if ($ipInfo['country'] != $ipip['country_name']) { + $ipInfo['country'] = $ipip['country_name']; + $ipInfo['province'] = $ipip['region_name']; + $ipInfo['city'] = $ipip['city_name']; + } + } + } + + if (empty($ipInfo) || empty($ipInfo['country'])) { + Log::warning("获取IP信息异常:" . $ip); + } + + $log = new UserLoginLog(); + $log->user_id = $userId; + $log->ip = $ip; + $log->country = $ipInfo['country'] ?? ''; + $log->province = $ipInfo['province'] ?? ''; + $log->city = $ipInfo['city'] ?? ''; + $log->county = $ipInfo['county'] ?? ''; + $log->isp = $ipInfo['isp'] ?? ($ipInfo['organization'] ?? ''); + $log->area = $ipInfo['area'] ?? ''; + $log->save(); + } + + /** + * 获取AFF + * + * @param string $code 邀请码 + * @param int $aff URL中的aff参数 + * + * @return array + */ + private function getAff($code = '', $aff = '') + { + // 邀请人ID + $referral_uid = 0; + + // 邀请码ID + $code_id = 0; + + // 有邀请码先用邀请码,用谁的邀请码就给谁返利 + if ($code) { + $inviteCode = Invite::query()->where('code', $code)->where('status', 0)->first(); + if ($inviteCode) { + $referral_uid = $inviteCode->uid; + $code_id = $inviteCode->id; + } + } + + // 没有用邀请码或者邀请码是管理员生成的,则检查cookie或者url链接 + if (!$referral_uid) { + // 检查一下cookie里有没有aff + $cookieAff = \Request::hasCookie('register_aff') ? \Request::cookie('register_aff') : 0; + if ($cookieAff) { + $affUser = User::query()->where('id', $cookieAff)->exists(); + $referral_uid = $affUser ? $cookieAff : 0; + } elseif ($aff) { // 如果cookie里没有aff,就再检查一下请求的url里有没有aff,因为有些人的浏览器会禁用了cookie,比如chrome开了隐私模式 + $affUser = User::query()->where('id', $aff)->exists(); + $referral_uid = $affUser ? $aff : 0; + } + } + + return [ + 'referral_uid' => $referral_uid, + 'code_id' => $code_id + ]; + } + + // 写入生成激活账号验证记录 + private function addVerify($userId, $token) + { + $verify = new Verify(); + $verify->type = 1; + $verify->user_id = $userId; + $verify->token = $token; + $verify->status = 0; + $verify->save(); + } + + // 生成注册验证码 + private function addVerifyCode($username, $code) + { + $verify = new VerifyCode(); + $verify->username = $username; + $verify->code = $code; + $verify->status = 0; + $verify->save(); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php deleted file mode 100644 index ef69c50f1..000000000 --- a/app/Http/Controllers/BaseController.php +++ /dev/null @@ -1,90 +0,0 @@ - $gb) { - return round($value / $gb, 2) . "GB"; - } else if (abs($value) > $mb) { - return round($value / $mb, 2) . "MB"; - } else if (abs($value) > $kb) { - return round($value / $kb, 2) . "KB"; - } else { - return round($value, 2); - } - } - - public static function toMB($traffic) - { - $mb = 1048576; - return $traffic * $mb; - } - - public static function toGB($traffic) - { - $gb = 1048576 * 1024; - return $traffic * $gb; - } - - public static function flowToGB($traffic) - { - $gb = 1048576 * 1024; - return $traffic / $gb; - } - - // 加密方式 - public function methodList() - { - return SsConfig::where('type', 1)->get(); - } - - // 协议 - public function protocolList() - { - return SsConfig::where('type', 2)->get(); - } - - // 混淆 - public function obfsList() - { - return SsConfig::where('type', 3)->get(); - } -} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a23e..03b493e50 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,6 +2,9 @@ namespace App\Http\Controllers; +use App\Http\Models\ReferralLog; +use App\Http\Models\SensitiveWords; +use App\Http\Models\UserBalanceLog; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; @@ -10,4 +13,154 @@ class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + + // 生成随机密码 + public function makePasswd() + { + exit(makeRandStr()); + } + + // 生成VmessId + public function makeVmessId() + { + exit(createGuid()); + } + + // 生成网站安全码 + public function makeSecurityCode() + { + exit(strtolower(makeRandStr(8))); + } + + // 类似Linux中的tail命令 + public function tail($file, $n, $base = 5) + { + $fileLines = $this->countLine($file); + if ($fileLines < 15000) { + return false; + } + + $fp = fopen($file, "r+"); + assert($n > 0); + $pos = $n + 1; + $lines = []; + while (count($lines) <= $n) { + try { + fseek($fp, -$pos, SEEK_END); + } catch (\Exception $e) { + fseek(0); + break; + } + + $pos *= $base; + while (!feof($fp)) { + array_unshift($lines, fgets($fp)); + } + } + + return array_slice($lines, 0, $n); + } + + /** + * 计算文件行数 + */ + public function countLine($file) + { + $fp = fopen($file, "r"); + $i = 0; + while (!feof($fp)) { + //每次读取2M + if ($data = fread($fp, 1024 * 1024 * 2)) { + //计算读取到的行数 + $num = substr_count($data, "\n"); + $i += $num; + } + } + + fclose($fp); + + return $i; + } + + /** + * 记录余额操作日志 + * + * @param int $userId 用户ID + * @param string $oid 订单ID + * @param int $before 记录前余额 + * @param int $after 记录后余额 + * @param int $amount 发生金额 + * @param string $desc 描述 + * + * @return int + */ + public function addUserBalanceLog($userId, $oid, $before, $after, $amount, $desc = '') + { + $log = new UserBalanceLog(); + $log->user_id = $userId; + $log->order_id = $oid; + $log->before = $before; + $log->after = $after; + $log->amount = $amount; + $log->desc = $desc; + $log->created_at = date('Y-m-d H:i:s'); + + return $log->save(); + } + + /** + * 添加返利日志 + * + * @param int $userId 用户ID + * @param int $refUserId 返利用户ID + * @param int $oid 订单ID + * @param int $amount 发生金额 + * @param int $refAmount 返利金额 + * + * @return int + */ + public function addReferralLog($userId, $refUserId, $oid, $amount, $refAmount) + { + $log = new ReferralLog(); + $log->user_id = $userId; + $log->ref_user_id = $refUserId; + $log->order_id = $oid; + $log->amount = $amount; + $log->ref_amount = $refAmount; + $log->status = 0; + + return $log->save(); + } + + // 获取敏感词 + public function sensitiveWords() + { + return SensitiveWords::query()->get()->pluck('words')->toArray(); + } + + // 将Base64图片转换为本地图片并保存 + function base64ImageSaver($base64_image_content) + { + // 匹配出图片的格式 + if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) { + $type = $result[2]; + + $directory = date('Ymd'); + $path = '/assets/images/qrcode/' . $directory . '/'; + if (!file_exists(public_path($path))) { // 检查是否有该文件夹,如果没有就创建,并给予最高权限 + mkdir(public_path($path), 0755, true); + } + + $fileName = makeRandStr(18, true) . ".{$type}"; + if (file_put_contents(public_path($path . $fileName), base64_decode(str_replace($result[1], '', $base64_image_content)))) { + chmod(public_path($path . $fileName), 0744); + + return $path . $fileName; + } else { + return ''; + } + } else { + return ''; + } + } } diff --git a/app/Http/Controllers/CouponController.php b/app/Http/Controllers/CouponController.php new file mode 100644 index 000000000..96fce2196 --- /dev/null +++ b/app/Http/Controllers/CouponController.php @@ -0,0 +1,182 @@ +orderBy('status', 'asc')->orderBy('id', 'desc')->paginate(10); + + return Response::view('coupon.couponList', $view); + } + + // 添加商品 + public function addCoupon(Request $request) + { + if ($request->isMethod('POST')) { + $this->validate($request, [ + 'name' => 'required', + 'type' => 'required|integer|between:1,3', + 'usage' => 'required|integer|between:1,2', + 'num' => 'required|integer|min:1', + 'amount' => 'required_unless:type,2|numeric|min:0.01|nullable', + 'discount' => 'required_if:type,2|numeric|between:1,9.9|nullable', + 'available_start' => 'required|date|before_or_equal:available_end', + 'available_end' => 'required|date|after_or_equal:available_start', + ], [ + 'name.required' => '请填入卡券名称', + 'type.required' => '请选择卡券类型', + 'type.integer' => '卡券类型不合法,请重选', + 'type.between' => '卡券类型不合法,请重选', + 'usage.required' => '请选择卡券用途', + 'usage.integer' => '卡券用途不合法,请重选', + 'usage.between' => '卡券用途不合法,请重选', + 'num.required' => '请填写卡券数量', + 'num.integer' => '卡券数量不合法', + 'num.min' => '卡券数量不合法,最小1', + 'amount.required_unless' => '请填入卡券面值', + 'amount.numeric' => '卡券金额不合法', + 'amount.min' => '卡券金额不合法,最小0.01', + 'discount.required_if' => '请填入卡券折扣', + 'discount.numeric' => '卡券折扣不合法', + 'discount.between' => '卡券折扣不合法,有效范围:1 ~ 9.9', + 'available_start.required' => '请填入有效期', + 'available_start.date' => '有效期不合法', + 'available_start.before_or_equal' => '有效期不合法', + 'available_end.required' => '请填入有效期', + 'available_end.date' => '有效期不合法', + 'available_end.after_or_equal' => '有效期不合法' + ]); + + // 商品LOGO + $logo = ''; + if ($request->hasFile('logo')) { + $file = $request->file('logo'); + $fileType = $file->getClientOriginalExtension(); + + // 验证文件合法性 + if (!in_array($fileType, ['jpg', 'png', 'jpeg', 'bmp'])) { + return Redirect::back()->withInput()->withErrors('LOGO不合法'); + } + + $logoName = date('YmdHis') . mt_rand(1000, 2000) . '.' . $fileType; + $move = $file->move(base_path() . '/public/upload/image/', $logoName); + $logo = $move ? '/upload/image/' . $logoName : ''; + } + + DB::beginTransaction(); + try { + for ($i = 0; $i < $request->num; $i++) { + $obj = new Coupon(); + $obj->name = $request->name; + $obj->sn = strtoupper(makeRandStr(7)); + $obj->logo = $logo; + $obj->type = $request->type; + $obj->usage = $request->usage; + $obj->amount = empty($request->amount) ? 0 : $request->amount; + $obj->discount = empty($request->discount) ? 0 : $request->discount; + $obj->available_start = strtotime(date('Y-m-d 00:00:00', strtotime($request->available_start))); + $obj->available_end = strtotime(date('Y-m-d 23:59:59', strtotime($request->available_end))); + $obj->status = 0; + $obj->save(); + } + + DB::commit(); + + return Redirect::back()->with('successMsg', '生成成功'); + } catch (\Exception $e) { + DB::rollBack(); + + Log::error('生成优惠券失败:' . $e->getMessage()); + + return Redirect::back()->withInput()->withErrors('生成失败:' . $e->getMessage()); + } + } else { + return Response::view('coupon.addCoupon'); + } + } + + // 删除优惠券 + public function delCoupon(Request $request) + { + Coupon::query()->where('id', $request->id)->delete(); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); + } + + // 导出卡券 + public function exportCoupon(Request $request) + { + $cashCouponList = Coupon::type(1)->where('status', 0)->get(); + $discountCouponList = Coupon::type(2)->where('status', 0)->get(); + $chargeCouponList = Coupon::type(3)->where('status', 0)->get(); + + $filename = '卡券' . date('Ymd') . '.xlsx'; + $spreadsheet = new Spreadsheet(); + $spreadsheet->getProperties()->setCreator('SSRPanel')->setLastModifiedBy('SSRPanel')->setTitle('邀请码')->setSubject('邀请码')->setDescription('')->setKeywords('')->setCategory(''); + + // 抵用券 + $spreadsheet->setActiveSheetIndex(0); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setTitle('抵用券'); + $sheet->fromArray(['名称', '类型', '有效期', '券码', '面额(元)'], null); + foreach ($cashCouponList as $k => $vo) { + $usage = '仅限一次性使用'; + $dateRange = date('Y-m-d', $vo->available_start) . ' ~ ' . date('Y-m-d', $vo->available_end); + $sheet->fromArray([$vo->name, $usage, $dateRange, $vo->sn, $vo->amount], null, 'A' . ($k + 2)); + } + + // 折扣券 + $spreadsheet->createSheet(1); + $spreadsheet->setActiveSheetIndex(1); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setTitle('折扣券'); + $sheet->fromArray(['名称', '类型', '有效期', '券码', '折扣(折)'], null); + foreach ($discountCouponList as $k => $vo) { + $usage = $vo->usage == 1 ? '仅限一次性使用' : '可重复使用'; + $dateRange = date('Y-m-d', $vo->available_start) . ' ~ ' . date('Y-m-d', $vo->available_end); + $sheet->fromArray([$vo->name, $usage, $dateRange, $vo->sn, $vo->discount], null, 'A' . ($k + 2)); + } + + // 充值券 + $spreadsheet->createSheet(2); + $spreadsheet->setActiveSheetIndex(2); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setTitle('充值券'); + $sheet->fromArray(['名称', '类型', '有效期', '券码', '面额(元)'], null); + foreach ($chargeCouponList as $k => $vo) { + $usage = '仅限一次性使用'; + $dateRange = date('Y-m-d', $vo->available_start) . ' ~ ' . date('Y-m-d', $vo->available_end); + $sheet->fromArray([$vo->name, $usage, $dateRange, $vo->sn, $vo->amount], null, 'A' . ($k + 2)); + } + + // 指针切换回第一个sheet + $spreadsheet->setActiveSheetIndex(0); + + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // 输出07Excel文件 + //header('Content-Type:application/vnd.ms-excel'); // 输出Excel03版本文件 + header('Content-Disposition: attachment;filename="' . $filename . '"'); + header('Cache-Control: max-age=0'); + $writer = new Xlsx($spreadsheet); + $writer->save('php://output'); + } +} diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php deleted file mode 100644 index 1e664d0fa..000000000 --- a/app/Http/Controllers/HomeController.php +++ /dev/null @@ -1,20 +0,0 @@ -method() == 'POST') { - $username = $request->get('username'); - $password = $request->get('password'); - - if (empty($username) || empty($password)) { - $request->session()->flash('error_msg', '请输入用户名和密码'); - return Redirect::to('login'); - } - - $user = User::where('username', $username)->where('password', md5($password))->where('is_admin', 1)->first(); - if (!$user) { - $request->session()->flash('error_msg', '用户名或密码错误'); - return Redirect::to('login'); - } - - $request->session()->put('user', $user->toArray()); - - return Redirect::to('admin'); - } else { - return Response::view('login'); - } - } - - // 退出 - public function logout(Request $request) - { - $request->session()->flush(); - - return Redirect::to('login'); - } - -} diff --git a/app/Http/Controllers/MarketingController.php b/app/Http/Controllers/MarketingController.php new file mode 100644 index 000000000..f1fce329b --- /dev/null +++ b/app/Http/Controllers/MarketingController.php @@ -0,0 +1,48 @@ +where('type', 1)->paginate(15); + + return Response::view('marketing.emailList', $view); + } + + private function addMarketing($type = 1, $title = '', $content = '', $status = 1, $error = '', $receiver = '') + { + $marketing = new Marketing(); + $marketing->type = $type; + $marketing->receiver = $receiver; + $marketing->title = $title; + $marketing->content = $content; + $marketing->error = $error; + $marketing->status = $status; + + return $marketing->save(); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php new file mode 100644 index 000000000..6b424478f --- /dev/null +++ b/app/Http/Controllers/PaymentController.php @@ -0,0 +1,287 @@ +get('goods_id')); + $coupon_sn = $request->get('coupon_sn'); + + $goods = Goods::query()->where('status', 1)->where('id', $goods_id)->first(); + if (!$goods) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:商品或服务已下架']); + } + + // 判断是否开启有赞云支付 + if (!self::$systemConfig['is_youzan'] && !self::$systemConfig['is_alipay'] && !self::$systemConfig['is_f2fpay']) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:系统并未开启在线支付功能']); + } + + // 判断是否存在同个商品的未支付订单 + $existsOrder = Order::uid()->where('status', 0)->where('goods_id', $goods_id)->exists(); + if ($existsOrder) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:尚有未支付的订单,请先去支付']); + } + + // 限购控制 + $strategy = self::$systemConfig['goods_purchase_limit_strategy']; + if ($strategy == 'all' || ($strategy == 'package' && $goods->type == 2) || ($strategy == 'free' && $goods->price == 0) || ($strategy == 'package&free' && ($goods->type == 2 || $goods->price == 0))) { + $noneExpireOrderExist = Order::uid()->where('status', '>=', 0)->where('is_expire', 0)->where('goods_id', $goods_id)->exists(); + if ($noneExpireOrderExist) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:商品不可重复购买']); + } + } + + // 单个商品限购 + if ($goods->is_limit == 1) { + $noneExpireOrderExist = Order::uid()->where('status', '>=', 0)->where('goods_id', $goods_id)->exists(); + if ($noneExpireOrderExist) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:此商品每人限购1次']); + } + } + + // 使用优惠券 + if ($coupon_sn) { + $coupon = Coupon::query()->where('status', 0)->whereIn('type', [1, 2])->where('sn', $coupon_sn)->first(); + if (!$coupon) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:优惠券不存在']); + } + + // 计算实际应支付总价 + $amount = $coupon->type == 2 ? $goods->price * $coupon->discount / 10 : $goods->price - $coupon->amount; + $amount = $amount > 0 ? round($amount, 2) : 0; // 四舍五入保留2位小数,避免无法正常创建订单 + } else { + $amount = $goods->price; + } + + // 价格异常判断 + if ($amount < 0) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:订单总价异常']); + } elseif ($amount == 0) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建支付单失败:订单总价为0,无需使用在线支付']); + } + + // 验证账号是否存在有效期更长的套餐 + if ($goods->type == 2) { + $existOrderList = Order::uid() + ->with(['goods']) + ->whereHas('goods', function ($q) { + $q->where('type', 2); + }) + ->where('is_expire', 0) + ->where('status', 2) + ->get(); + + foreach ($existOrderList as $vo) { + if ($vo->goods->days > $goods->days) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '支付失败:您已存在有效期更长的套餐,只能购买流量包']); + } + } + } + + DB::beginTransaction(); + try { + $orderSn = date('ymdHis') . mt_rand(100000, 999999); + $sn = makeRandStr(12); + + // 支付方式 + if (self::$systemConfig['is_youzan']) { + $pay_way = 2; + } elseif (self::$systemConfig['is_alipay']) { + $pay_way = 4; + } elseif (self::$systemConfig['is_f2fpay']) { + $pay_way = 5; + } + + // 生成订单 + $order = new Order(); + $order->order_sn = $orderSn; + $order->user_id = Auth::user()->id; + $order->goods_id = $goods_id; + $order->coupon_id = !empty($coupon) ? $coupon->id : 0; + $order->origin_amount = $goods->price; + $order->amount = $amount; + $order->expire_at = date("Y-m-d H:i:s", strtotime("+" . $goods->days . " days")); + $order->is_expire = 0; + $order->pay_way = $pay_way; + $order->status = 0; + $order->save(); + + // 生成支付单 + if (self::$systemConfig['is_youzan']) { + $yzy = new Yzy(); + $result = $yzy->createQrCode($goods->name, $amount * 100, $orderSn); + if (isset($result['error_response'])) { + Log::error('【有赞云】创建二维码失败:' . $result['error_response']['msg']); + + throw new \Exception($result['error_response']['msg']); + } + } elseif (self::$systemConfig['is_alipay']) { + $parameter = [ + "service" => "create_forex_trade", // WAP:create_forex_trade_wap ,即时到帐:create_forex_trade + "partner" => self::$systemConfig['alipay_partner'], + "notify_url" => self::$systemConfig['website_url'] . "/api/alipay", // 异步回调接口 + "return_url" => self::$systemConfig['website_url'], + "out_trade_no" => $orderSn, // 订单号 + "subject" => "Package", // 订单名称 + //"total_fee" => $amount, // 金额 + "rmb_fee" => $amount, // 使用RMB标价,不再使用总金额 + "body" => "", // 商品描述,可为空 + "currency" => self::$systemConfig['alipay_currency'], // 结算币种 + "product_code" => "NEW_OVERSEAS_SELLER", + "_input_charset" => "utf-8" + ]; + + // 建立请求 + $alipaySubmit = new AlipaySubmit(self::$systemConfig['alipay_sign_type'], self::$systemConfig['alipay_partner'], self::$systemConfig['alipay_key'], self::$systemConfig['alipay_private_key']); + $result = $alipaySubmit->buildRequestForm($parameter, "post", "确认"); + } elseif (self::$systemConfig['is_f2fpay']) { + // TODO:goods表里增加一个字段用于自定义商品付款时展示的商品名称, + // TODO:这里增加一个随机商品列表,根据goods的价格随机取值 + $result = Charge::run("ali_qr", [ + 'use_sandbox' => false, + "partner" => self::$systemConfig['f2fpay_app_id'], + 'app_id' => self::$systemConfig['f2fpay_app_id'], + 'sign_type' => 'RSA2', + 'ali_public_key' => self::$systemConfig['f2fpay_public_key'], + 'rsa_private_key' => self::$systemConfig['f2fpay_private_key'], + 'notify_url' => self::$systemConfig['website_url'] . "/api/f2fpay", // 异步回调接口 + 'return_url' => self::$systemConfig['website_url'], + 'return_raw' => false + ], [ + 'body' => '', + 'subject' => self::$systemConfig['f2fpay_subject_name'], + 'order_no' => $orderSn, + 'amount' => $amount, + ]); + } + + $payment = new Payment(); + $payment->sn = $sn; + $payment->user_id = Auth::user()->id; + $payment->oid = $order->oid; + $payment->order_sn = $orderSn; + $payment->pay_way = 1; + $payment->amount = $amount; + if (self::$systemConfig['is_youzan']) { + $payment->qr_id = $result['response']['qr_id']; + $payment->qr_url = $result['response']['qr_url']; + $payment->qr_code = $result['response']['qr_code']; + $payment->qr_local_url = $this->base64ImageSaver($result['response']['qr_code']); + } elseif (self::$systemConfig['is_alipay']) { + $payment->qr_code = $result; + } elseif (self::$systemConfig['is_f2fpay']) { + $payment->qr_code = $result; + $payment->qr_url = 'http://qr.topscan.com/api.php?text=' . $result . '&bg=ffffff&fg=000000&pt=1c73bd&m=10&w=400&el=1&inpt=1eabfc&logo=https://t.alipayobjects.com/tfscom/T1Z5XfXdxmXXXXXXXX.png'; + $payment->qr_local_url = $payment->qr_url; + } + $payment->status = 0; + $payment->save(); + + // 优惠券置为已使用 + if (!empty($coupon)) { + if ($coupon->usage == 1) { + $coupon->status = 1; + $coupon->save(); + } + + Helpers::addCouponLog($coupon->id, $goods_id, $order->oid, '在线支付使用'); + } + + DB::commit(); + + if (self::$systemConfig['is_alipay']) { // Alipay返回支付信息 + return Response::json(['status' => 'success', 'data' => $result, 'message' => '创建订单成功,正在转到付款页面,请稍后']); + } else { + return Response::json(['status' => 'success', 'data' => $sn, 'message' => '创建订单成功,正在转到付款页面,请稍后']); + } + } catch (\Exception $e) { + DB::rollBack(); + + Log::error('创建支付订单失败:' . $e->getMessage()); + + return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建订单失败:' . $e->getMessage()]); + } + } + + // 支付单详情 + public function detail(Request $request, $sn) + { + $view['payment'] = Payment::uid()->with(['order', 'order.goods'])->where('sn', $sn)->firstOrFail(); + + return Response::view('payment.detail', $view); + } + + // 获取订单支付状态 + public function getStatus(Request $request) + { + $validator = Validator::make($request->all(), [ + 'sn' => 'required|exists:payment,sn' + ], [ + 'sn.required' => '请求失败:缺少sn', + 'sn.exists' => '支付失败:支付单不存在' + ]); + + if ($validator->fails()) { + return Response::json(['status' => 'error', 'data' => '', 'message' => $validator->getMessageBag()->first()]); + } + + $payment = Payment::uid()->where('sn', $request->sn)->first(); + if ($payment->status > 0) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '支付成功']); + } elseif ($payment->status < 0) { + return Response::json(['status' => 'error', 'data' => '', 'message' => '订单超时未支付,已自动关闭']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '等待支付']); + } + } + + // 回调日志 + public function callbackList(Request $request) + { + $status = $request->get('status', 0); + + $query = PaymentCallback::query(); + + if ($status) { + $query->where('status', $status); + } + + $view['list'] = $query->orderBy('id', 'desc')->paginate(10); + + return Response::view('payment.callbackList', $view); + } +} diff --git a/app/Http/Controllers/SensitiveWordsController.php b/app/Http/Controllers/SensitiveWordsController.php new file mode 100644 index 000000000..653c33e30 --- /dev/null +++ b/app/Http/Controllers/SensitiveWordsController.php @@ -0,0 +1,62 @@ +orderBy('id', 'desc')->paginate(15); + + return Response::view('sensitiveWords.sensitiveWordsList', $view); + } + + // 添加敏感词 + public function addSensitiveWords(Request $request) + { + $validator = Validator::make($request->all(), [ + 'words' => 'required|unique:sensitive_words' + ], [ + 'words.required' => '添加失败:请填写敏感词', + 'words.unique' => '添加失败:敏感词已存在' + ]); + + if ($validator->fails()) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => $validator->getMessageBag()->first()]); + } + + $obj = new SensitiveWords(); + $obj->words = strtolower($request->words); + $obj->save(); + if ($obj->id) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '添加失败']); + } + } + + // 删除敏感词 + public function delSensitiveWords(Request $request) + { + $result = SensitiveWords::query()->where('id', $request->id)->delete(); + if ($result) { + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); + } else { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '删除失败']); + } + } + +} diff --git a/app/Http/Controllers/ShopController.php b/app/Http/Controllers/ShopController.php new file mode 100644 index 000000000..4b5d76dac --- /dev/null +++ b/app/Http/Controllers/ShopController.php @@ -0,0 +1,252 @@ +orderBy('id', 'desc')->paginate(10); + + return Response::view('shop.goodsList', $view); + } + + // 添加商品 + public function addGoods(Request $request) + { + if ($request->isMethod('POST')) { + $this->validate($request, [ + 'name' => 'required', + 'traffic' => 'required_unless:type,3|integer|min:1024|max:10240000|nullable', + 'price' => 'required|numeric|min:0', + 'type' => 'required', + 'days' => 'required|integer', + ], [ + 'name.required' => '请填入名称', + 'traffic.required_unless' => '请填入流量', + 'traffic.integer' => '内含流量必须是整数值', + 'traffic.min' => '内含流量不能低于1MB', + 'traffic.max' => '内含流量不能超过10TB', + 'price.required' => '请填入价格', + 'price.numeric' => '价格不合法', + 'price.min' => '价格最低0', + 'type.required' => '请选择类型', + 'days.required' => '请填入有效期', + 'days.integer' => '有效期不合法', + ]); + + // 套餐必须有价格 + if ($request->type == 2 && $request->price <= 0) { + return Redirect::back()->withInput()->withErrors('套餐价格必须大于0'); + } + + // 套餐有效天数必须大于90天 + if ($request->type == 2 && $request->days < 90) { + return Redirect::back()->withInput()->withErrors('套餐有效天数必须不能少于90天'); + } + + // 商品LOGO + $logo = ''; + if ($request->hasFile('logo')) { + $file = $request->file('logo'); + $fileType = $file->getClientOriginalExtension(); + + // 验证文件合法性 + if (!in_array($fileType, ['jpg', 'png', 'jpeg', 'bmp'])) { + return Redirect::back()->withInput()->withErrors('LOGO不合法'); + } + + $logoName = date('YmdHis') . mt_rand(1000, 2000) . '.' . $fileType; + $move = $file->move(base_path() . '/public/upload/image/', $logoName); + $logo = $move ? '/upload/image/' . $logoName : ''; + } + + DB::beginTransaction(); + try { + $goods = new Goods(); + $goods->name = $request->name; + $goods->desc = $request->desc; + $goods->logo = $logo; + $goods->traffic = $request->traffic; + $goods->price = round($request->price, 2); + $goods->type = $request->type; + $goods->days = $request->days; + $goods->color = $request->color; + $goods->sort = intval($request->sort); + $goods->is_hot = intval($request->is_hot); + $goods->is_limit = intval($request->is_limit); + $goods->status = $request->status; + $goods->save(); + + // 生成SKU + $goods->sku = 'S0000' . $goods->id; + $goods->save(); + + // 生成商品标签 + $labels = $request->get('labels'); + if (!empty($labels)) { + foreach ($labels as $label) { + $goodsLabel = new GoodsLabel(); + $goodsLabel->goods_id = $goods->id; + $goodsLabel->label_id = $label; + $goodsLabel->save(); + } + } + + DB::commit(); + + return Redirect::back()->with('successMsg', '添加成功'); + } catch (\Exception $e) { + DB::rollBack(); + Log::info($e); + + return Redirect::back()->withInput()->withErrors('添加失败'); + } + } else { + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); + + return Response::view('shop.addGoods', $view); + } + } + + // 编辑商品 + public function editGoods(Request $request) + { + $id = $request->get('id'); + + if ($request->isMethod('POST')) { + $name = $request->get('name'); + $desc = $request->get('desc'); + $price = round($request->get('price'), 2); + $labels = $request->get('labels'); + $color = trim($request->get('color', 0)); + $sort = intval($request->get('sort', 0)); + $is_hot = intval($request->get('is_hot', 0)); + $is_limit = intval($request->get('is_limit', 0)); + $status = $request->get('status'); + + $goods = Goods::query()->where('id', $id)->first(); + if (!$goods) { + Session::flash('errorMsg', '商品不存在'); + + return Redirect::back(); + } + + if (empty($name)) { + Session::flash('errorMsg', '请填写完整'); + + return Redirect::back()->withInput(); + } + + // 套餐必须有价格 + if ($goods->type == 2 && $price <= 0) { + Session::flash('errorMsg', '套餐价格必须大于0'); + + return Redirect::back()->withInput(); + } + + // 商品LOGO + $logo = ''; + if ($request->hasFile('logo')) { + $file = $request->file('logo'); + $fileType = $file->getClientOriginalExtension(); + + // 验证文件合法性 + if (!in_array($fileType, ['jpg', 'png', 'jpeg', 'bmp'])) { + Session::flash('errorMsg', 'LOGO不合法'); + + return Redirect::back()->withInput(); + } + + $logoName = date('YmdHis') . mt_rand(1000, 2000) . '.' . $fileType; + $move = $file->move(base_path() . '/public/upload/image/', $logoName); + $logo = $move ? '/upload/image/' . $logoName : ''; + } + + DB::beginTransaction(); + try { + $data = [ + 'name' => $name, + 'desc' => $desc, + 'price' => $price * 100, + 'sort' => $sort, + 'color' => $color, + 'is_hot' => $is_hot, + 'is_limit' => $is_limit, + 'status' => $status + ]; + + if ($logo) { + $data['logo'] = $logo; + } + + Goods::query()->where('id', $id)->update($data); + + // 先删除该商品所有的标签 + GoodsLabel::query()->where('goods_id', $id)->delete(); + + // 生成商品标签 + if (!empty($labels)) { + foreach ($labels as $label) { + $goodsLabel = new GoodsLabel(); + $goodsLabel->goods_id = $id; + $goodsLabel->label_id = $label; + $goodsLabel->save(); + } + } + + Session::flash('successMsg', '编辑成功'); + + DB::commit(); + } catch (\Exception $e) { + Session::flash('errorMsg', '编辑失败'); + + DB::rollBack(); + } + + return Redirect::to('shop/editGoods?id=' . $id); + } else { + $goods = Goods::query()->with(['label'])->where('id', $id)->first(); + if ($goods) { + $label = []; + foreach ($goods->label as $vo) { + $label[] = $vo->label_id; + } + $goods->labels = $label; + } + + $view['goods'] = $goods; + $view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get(); + + return Response::view('shop.editGoods', $view); + } + } + + // 删除商品 + public function delGoods(Request $request) + { + $id = $request->get('id'); + + Goods::query()->where('id', $id)->delete(); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']); + } +} diff --git a/app/Http/Controllers/SubscribeController.php b/app/Http/Controllers/SubscribeController.php new file mode 100644 index 000000000..64c652892 --- /dev/null +++ b/app/Http/Controllers/SubscribeController.php @@ -0,0 +1,285 @@ +get('user_id'); + $username = $request->get('username'); + $status = $request->get('status'); + + $query = UserSubscribe::with(['User']); + + if (!empty($user_id)) { + $query->where('user_id', $user_id); + } + + if (!empty($username)) { + $query->whereHas('user', function ($q) use ($username) { + $q->where('username', 'like', '%' . $username . '%'); + }); + } + + if ($status != '') { + $query->where('status', intval($status)); + } + + $view['subscribeList'] = $query->orderBy('id', 'desc')->paginate(20)->appends($request->except('page')); + + return Response::view('subscribe.subscribeList', $view); + } + + // 订阅设备列表 + public function deviceList(Request $request) + { + $type = intval($request->get('type')); + $platform = intval($request->get('platform')); + $name = trim($request->get('name')); + $status = intval($request->get('status')); + + $query = Device::query(); + + if (!empty($type)) { + $query->where('type', $type); + } + + if ($platform != '') { + $query->where('platform', $platform); + } + + if (!empty($name)) { + $query->where('name', 'like', '%' . $name . '%'); + } + + if ($status != '') { + $query->where('status', $status); + } + + $view['deviceList'] = $query->paginate(20)->appends($request->except('page')); + + return Response::view('subscribe.deviceList', $view); + } + + // 设置用户的订阅的状态 + public function setSubscribeStatus(Request $request) + { + $id = $request->get('id'); + $status = $request->get('status', 0); + + if (empty($id)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '操作异常']); + } + + if ($status) { + UserSubscribe::query()->where('id', $id)->update(['status' => 1, 'ban_time' => 0, 'ban_desc' => '']); + } else { + UserSubscribe::query()->where('id', $id)->update(['status' => 0, 'ban_time' => time(), 'ban_desc' => '后台手动封禁']); + } + + return Response::json(['status' => 'success', 'data' => '', 'message' => '操作成功']); + } + + // 设置设备是否允许订阅的状态 + public function setDeviceStatus(Request $request) + { + $id = intval($request->get('id')); + $status = intval($request->get('status', 0)); + + if (empty($id)) { + return Response::json(['status' => 'fail', 'data' => '', 'message' => '操作异常']); + } + + Device::query()->where('id', $id)->update(['status' => $status]); + + return Response::json(['status' => 'success', 'data' => '', 'message' => '操作成功']); + } + + // 通过订阅码获取订阅信息 + public function getSubscribeByCode(Request $request, $code) + { + if (empty($code)) { + return Redirect::to('login'); + } + + // 校验合法性 + $subscribe = UserSubscribe::query()->with('user')->where('status', 1)->where('code', $code)->first(); + if (!$subscribe) { + exit($this->noneNode()); + } + + $user = User::query()->whereIn('status', [0, 1])->where('enable', 1)->where('id', $subscribe->user_id)->first(); + if (!$user) { + exit($this->noneNode()); + } + + // 更新访问次数 + $subscribe->increment('times', 1); + + // 记录每次请求 + $this->log($subscribe->id, getClientIp(), $request->headers); + + // 获取这个账号可用节点 + $userLabelIds = UserLabel::query()->where('user_id', $user->id)->pluck('label_id'); + if (empty($userLabelIds)) { + exit($this->noneNode()); + } + + $query = SsNode::query()->selectRaw('ss_node.*')->leftjoin("ss_node_label", "ss_node.id", "=", "ss_node_label.node_id"); + + // 启用混合订阅时,加入V2Ray节点,未启用时仅下发SSR节点信息 + if (!self::$systemConfig['mix_subscribe']) { + $query->where('ss_node.type', 1); + } + + $nodeList = $query->where('ss_node.status', 1)->where('ss_node.is_subscribe', 1)->whereIn('ss_node_label.label_id', $userLabelIds)->groupBy('ss_node.id')->orderBy('ss_node.sort', 'desc')->orderBy('ss_node.id', 'asc')->get()->toArray(); + if (empty($nodeList)) { + exit($this->noneNode()); + } + + // 打乱数组 + if (self::$systemConfig['rand_subscribe']) { + shuffle($nodeList); + } + + // 控制客户端最多获取节点数 + $scheme = ''; + + // 展示到期时间和剩余流量 + if (self::$systemConfig['is_custom_subscribe']) { + $scheme .= $this->expireDate($user); + $scheme .= $this->lastTraffic($user); + } + + foreach ($nodeList as $key => $node) { + // 控制显示的节点数 + if (self::$systemConfig['subscribe_max'] && $key >= self::$systemConfig['subscribe_max']) { + break; + } + + // 获取分组名称 + if ($node['type'] == 1) { + $group = SsGroup::query()->where('id', $node['group_id'])->first(); + + $obfs_param = $user->obfs_param ? $user->obfs_param : $node['obfs_param']; + $protocol_param = $node['single'] ? $user->port . ':' . $user->passwd : $user->protocol_param; + + // 生成ssr scheme + $ssr_str = ($node['server'] ? $node['server'] : $node['ip']) . ':' . ($node['single'] ? $node['single_port'] : $user->port); + $ssr_str .= ':' . ($node['single'] ? $node['single_protocol'] : $user->protocol) . ':' . ($node['single'] ? $node['single_method'] : $user->method); + $ssr_str .= ':' . ($node['single'] ? $node['single_obfs'] : $user->obfs) . ':' . ($node['single'] ? base64url_encode($node['single_passwd']) : base64url_encode($user->passwd)); + $ssr_str .= '/?obfsparam=' . base64url_encode($obfs_param); + $ssr_str .= '&protoparam=' . ($node['single'] ? base64url_encode($user->port . ':' . $user->passwd) : base64url_encode($protocol_param)); + $ssr_str .= '&remarks=' . base64url_encode($node['name']); + $ssr_str .= '&group=' . base64url_encode(empty($group) ? Helpers::systemConfig()['website_name'] : $group->name); + $ssr_str .= '&udpport=0'; + $ssr_str .= '&uot=0'; + $ssr_str = base64url_encode($ssr_str); + $scheme .= 'ssr://' . $ssr_str . "\n"; + } else { + // 生成v2ray scheme + $v2_json = [ + "v" => "2", + "ps" => $node['name'], + "add" => $node['server'] ? $node['server'] : $node['ip'], + "port" => $node['v2_port'], + "id" => $user->vmess_id, + "aid" => $node['v2_alter_id'], + "net" => $node['v2_net'], + "type" => $node['v2_type'], + "host" => $node['v2_host'], + "path" => $node['v2_path'], + "tls" => $node['v2_tls'] ? "tls" : "" + ]; + + $scheme .= 'vmess://' . base64url_encode(json_encode($v2_json, JSON_PRETTY_PRINT)) . "\n"; + } + } + + // 适配Quantumult的自定义订阅头 + if (self::$systemConfig['is_custom_subscribe']) { + $headers = [ + 'Content-type' => 'application/octet-stream; charset=utf-8', + 'Cache-Control' => 'no-store, no-cache, must-revalidate', + 'Subscription-Userinfo' => 'upload=' . $user->u . '; download=' . $user->d . '; total=' . $user->transfer_enable . '; expire=' . strtotime($user->expire_time) + ]; + + return Response::make(base64url_encode($scheme), 200, $headers); + } else { + return Response::make(base64url_encode($scheme)); + } + } + + // 写入订阅访问日志 + private function log($subscribeId, $ip, $headers) + { + $log = new UserSubscribeLog(); + $log->sid = $subscribeId; + $log->request_ip = $ip; + $log->request_time = date('Y-m-d H:i:s'); + $log->request_header = $headers; + $log->save(); + } + + // 抛出无可用的节点信息,用于兼容防止客户端订阅失败 + private function noneNode() + { + return base64url_encode('ssr://' . base64url_encode('0.0.0.0:1:origin:none:plain:' . base64url_encode('0000') . '/?obfsparam=&protoparam=&remarks=' . base64url_encode('无可用节点或账号被封禁或订阅被封禁') . '&group=' . base64url_encode('错误') . '&udpport=0&uot=0') . "\n"); + } + + /** + * 过期时间 + * + * @param object $user + * + * @return string + */ + private function expireDate($user) + { + $text = '到期时间:' . $user->expire_time; + + return 'ssr://' . base64url_encode('0.0.0.1:1:origin:none:plain:' . base64url_encode('0000') . '/?obfsparam=&protoparam=&remarks=' . base64url_encode($text) . '&group=' . base64url_encode(Helpers::systemConfig()['website_name']) . '&udpport=0&uot=0') . "\n"; + } + + /** + * 剩余流量 + * + * @param object $user + * + * @return string + */ + private function lastTraffic($user) + { + $text = '剩余流量:' . flowAutoShow($user->transfer_enable - $user->u - $user->d); + + return 'ssr://' . base64url_encode('0.0.0.2:1:origin:none:plain:' . base64url_encode('0000') . '/?obfsparam=&protoparam=&remarks=' . base64url_encode($text) . '&group=' . base64url_encode(Helpers::systemConfig()['website_name']) . '&udpport=0&uot=0') . "\n"; + } +} diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php new file mode 100644 index 000000000..04a801d2a --- /dev/null +++ b/app/Http/Controllers/TicketController.php @@ -0,0 +1,120 @@ +orderBy('id', 'desc')->paginate(10); + + return Response::view('ticket.ticketList', $view); + } + + // 回复工单 + public function replyTicket(Request $request) + { + $id = $request->get('id'); + + if ($request->isMethod('POST')) { + $content = clean($request->get('content')); + $content = str_replace("eval", "", str_replace("atob", "", $content)); + $content = substr($content, 0, 300); + + $obj = new TicketReply(); + $obj->ticket_id = $id; + $obj->user_id = Auth::user()->id; + $obj->content = $content; + $obj->save(); + + if ($obj->id) { + // 将工单置为已回复 + $ticket = Ticket::query()->with(['user'])->where('id', $id)->first(); + $ticket->status = 1; + $ticket->save(); + + + $title = "工单回复提醒"; + $content = "标题:" . $ticket->title . "
"; + echo "GET /api/ping?token=toke_value&host=www.baidu.com&port=80&transport=tcp&timeout=0.5"; + echo "
"; + echo "token:.env下加入API_TOKEN,其值就是token的值"; + echo "
"; + echo "host:检测地址,必传,可以是域名、IPv4、IPv6"; + echo "
"; + echo "port:检测端口,可不传,默认22"; + echo "
"; + echo "transport:检测协议,可不传,默认tcp,可以是tcp、udp"; + echo "
"; + echo "timeout:检测超时,单位秒,可不传,默认0.5秒,建议不超过3秒"; + echo "
"; + echo "成功返回:1,失败返回:0"; + echo "
'+(t[0]||this._lang[0])+"
";var i=this.query(this.option,"toolbox.feature.dataView.optionToContent");"function"!=typeof i?this._textArea.value=this._optionToContent():(this._textArea=document.createElement("div"),this._textArea.innerHTML=i(this.option)),this._textArea.style.cssText="display:block;margin:0 0 8px 0;padding:4px 6px;overflow:auto;width:100%;height:"+(this._zrHeight-100)+"px;",this._tDom.appendChild(this._textArea),this._buttonClose.style.cssText="float:right;padding:1px 6px;",this._buttonClose.innerHTML=t[1]||this._lang[1];var n=this;this._buttonClose.onclick=function(){n.hide()},this._tDom.appendChild(this._buttonClose),this.query(this.option,"toolbox.feature.dataView.readOnly")===!1?(this._buttonRefresh.style.cssText="float:right;margin-right:10px;padding:1px 6px;",this._buttonRefresh.innerHTML=t[2]||this._lang[2],this._buttonRefresh.onclick=function(){n._save()},this._textArea.readOnly=!1,this._textArea.style.cursor="default"):(this._buttonRefresh.style.cssText="display:none", -this._textArea.readOnly=!0,this._textArea.style.cursor="text"),this._tDom.appendChild(this._buttonRefresh),this._sizeCssText="width:"+this._zrWidth+"px;height:"+this._zrHeight+"px;background-color:#fff;",this._tDom.style.cssText=this._gCssText+this._sizeCssText},_optionToContent:function(){var e,t,i,a,o,r,s=[],l="";if(this.option.xAxis)for(s=this.option.xAxis instanceof Array?this.option.xAxis:[this.option.xAxis],e=0,a=s.length;a>e;e++)if("category"==(s[e].type||"category")){for(r=[],t=0,i=s[e].data.length;i>t;t++)r.push(this.getDataFromOption(s[e].data[t]));l+=r.join(", ")+"\n\n"}if(this.option.yAxis)for(s=this.option.yAxis instanceof Array?this.option.yAxis:[this.option.yAxis],e=0,a=s.length;a>e;e++)if("category"==s[e].type){for(r=[],t=0,i=s[e].data.length;i>t;t++)r.push(this.getDataFromOption(s[e].data[t]));l+=r.join(", ")+"\n\n"}var h,m=this.option.series;for(e=0,a=m.length;a>e;e++){for(r=[],t=0,i=m[e].data.length;i>t;t++)o=m[e].data[t],h=m[e].type==n.CHART_TYPE_PIE||m[e].type==n.CHART_TYPE_MAP?(o.name||"-")+":":"",m[e].type==n.CHART_TYPE_SCATTER&&(o=this.getDataFromOption(o).join(", ")),r.push(h+this.getDataFromOption(o));l+=(m[e].name||"-")+" : \n",l+=r.join(m[e].type==n.CHART_TYPE_SCATTER?"\n":", "),l+="\n\n"}return l},_save:function(){var e=this.query(this.option,"toolbox.feature.dataView.contentToOption");if("function"!=typeof e){for(var t=this._textArea.value.split("\n"),i=[],a=0,o=t.length;o>a;a++)t[a]=this._trim(t[a]),""!==t[a]&&i.push(t[a]);this._contentToOption(i)}else e(this._textArea,this.option);this.hide();var r=this;setTimeout(function(){r.messageCenter&&r.messageCenter.dispatch(n.EVENT.DATA_VIEW_CHANGED,null,{option:r.option},r.myChart)},r.canvasSupported?800:100)},_contentToOption:function(e){var t,i,a,o,r,s,l,h=[],m=0;if(this.option.xAxis)for(h=this.option.xAxis instanceof Array?this.option.xAxis:[this.option.xAxis],t=0,o=h.length;o>t;t++)if("category"==(h[t].type||"category")){for(s=e[m].split(","),i=0,a=h[t].data.length;a>i;i++)l=this._trim(s[i]||""),r=h[t].data[i],"undefined"!=typeof h[t].data[i].value?h[t].data[i].value=l:h[t].data[i]=l;m++}if(this.option.yAxis)for(h=this.option.yAxis instanceof Array?this.option.yAxis:[this.option.yAxis],t=0,o=h.length;o>t;t++)if("category"==h[t].type){for(s=e[m].split(","),i=0,a=h[t].data.length;a>i;i++)l=this._trim(s[i]||""),r=h[t].data[i],"undefined"!=typeof h[t].data[i].value?h[t].data[i].value=l:h[t].data[i]=l;m++}var V=this.option.series;for(t=0,o=V.length;o>t;t++)if(m++,V[t].type==n.CHART_TYPE_SCATTER)for(var i=0,a=V[t].data.length;a>i;i++)s=e[m],l=s.replace(" ","").split(","),"undefined"!=typeof V[t].data[i].value?V[t].data[i].value=l:V[t].data[i]=l,m++;else{s=e[m].split(",");for(var i=0,a=V[t].data.length;a>i;i++)l=(s[i]||"").replace(/.*:/,""),l=this._trim(l),l="-"!=l&&""!==l?l-0:"-","undefined"!=typeof V[t].data[i].value?V[t].data[i].value=l:V[t].data[i]=l;m++}},_trim:function(e){var t=new RegExp("(^[\\s\\t\\xa0\\u3000]+)|([\\u3000\\xa0\\s\\t]+$)","g");return e.replace(t,"")},_stop:function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},resize:function(){this._zrHeight=this.zr.getHeight(),this._zrWidth=this.zr.getWidth(),this._tDom.offsetHeight>10&&(this._sizeCssText="width:"+this._zrWidth+"px;height:"+this._zrHeight+"px;background-color:#fff;",this._tDom.style.cssText=this._gCssText+this._sizeCssText,this._textArea.style.cssText="display:block;margin:0 0 8px 0;padding:4px 6px;overflow:auto;width:100%;height:"+(this._zrHeight-100)+"px;")},dispose:function(){window.removeEventListener?(this._tDom.removeEventListener("click",this._stop),this._tDom.removeEventListener("mousewheel",this._stop),this._tDom.removeEventListener("mousemove",this._stop),this._tDom.removeEventListener("mousedown",this._stop),this._tDom.removeEventListener("mouseup",this._stop),this._tDom.removeEventListener("touchstart",this._stop),this._tDom.removeEventListener("touchmove",this._stop),this._tDom.removeEventListener("touchend",this._stop)):(this._tDom.detachEvent("onclick",this._stop),this._tDom.detachEvent("onmousewheel",this._stop),this._tDom.detachEvent("onmousemove",this._stop),this._tDom.detachEvent("onmousedown",this._stop),this._tDom.detachEvent("onmouseup",this._stop)),this._buttonRefresh.onclick=null,this._buttonClose.onclick=null,this._hasShow&&(this._tDom.removeChild(this._textArea),this._tDom.removeChild(this._buttonRefresh),this._tDom.removeChild(this._buttonClose)),this._textArea=null,this._buttonRefresh=null,this._buttonClose=null,this.dom.firstChild.removeChild(this._tDom),this._tDom=null}},a.inherits(t,i),e("../component").define("dataView",t),t}),i("echarts/util/shape/Cross",["require","zrender/shape/Base","zrender/shape/Line","zrender/tool/util","./normalIsCover"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/shape/Line"),a=e("zrender/tool/util");return t.prototype={type:"cross",buildPath:function(e,t){var i=t.rect;t.xStart=i.x,t.xEnd=i.x+i.width,t.yStart=t.yEnd=t.y,n.prototype.buildPath(e,t),t.xStart=t.xEnd=t.x,t.yStart=i.y,t.yEnd=i.y+i.height,n.prototype.buildPath(e,t)},getRect:function(e){return e.rect},isCover:e("./normalIsCover")},a.inherits(t,i),t}),i("zrender/shape/Sector",["require","../tool/math","../tool/computeBoundingBox","../tool/vector","./Base","../tool/util"],function(e){var t=e("../tool/math"),i=e("../tool/computeBoundingBox"),n=e("../tool/vector"),a=e("./Base"),o=n.create(),r=n.create(),s=n.create(),l=n.create(),h=function(e){a.call(this,e)};return h.prototype={type:"sector",buildPath:function(e,i){var n=i.x,a=i.y,o=i.r0||0,r=i.r,s=i.startAngle,l=i.endAngle,h=i.clockWise||!1;s=t.degreeToRadian(s),l=t.degreeToRadian(l),h||(s=-s,l=-l);var m=t.cos(s),V=t.sin(s);e.moveTo(m*o+n,V*o+a),e.lineTo(m*r+n,V*r+a),e.arc(n,a,r,s,l,!h),e.lineTo(t.cos(l)*o+n,t.sin(l)*o+a),0!==o&&e.arc(n,a,o,l,s,h),e.closePath()},getRect:function(e){if(e.__rect)return e.__rect;var a=e.x,h=e.y,m=e.r0||0,V=e.r,U=t.degreeToRadian(e.startAngle),d=t.degreeToRadian(e.endAngle),p=e.clockWise;return p||(U=-U,d=-d),m>1?i.arc(a,h,m,U,d,!p,o,s):(o[0]=s[0]=a,o[1]=s[1]=h),i.arc(a,h,V,U,d,!p,r,l),n.min(o,o,r),n.max(s,s,l),e.__rect={x:o[0],y:o[1],width:s[0]-o[0],height:s[1]-o[1]},e.__rect}},e("../tool/util").inherits(h,a),h}),i("echarts/util/shape/Candle",["require","zrender/shape/Base","zrender/tool/util","./normalIsCover"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/tool/util");return t.prototype={type:"candle",_numberOrder:function(e,t){return t-e},buildPath:function(e,t){var i=n.clone(t.y).sort(this._numberOrder);e.moveTo(t.x,i[3]),e.lineTo(t.x,i[2]),e.moveTo(t.x-t.width/2,i[2]),e.rect(t.x-t.width/2,i[2],t.width,i[1]-i[2]),e.moveTo(t.x,i[1]),e.lineTo(t.x,i[0])},getRect:function(e){if(!e.__rect){var t=0;("stroke"==e.brushType||"fill"==e.brushType)&&(t=e.lineWidth||1);var i=n.clone(e.y).sort(this._numberOrder);e.__rect={x:Math.round(e.x-e.width/2-t/2),y:Math.round(i[3]-t/2),width:e.width+t,height:i[0]-i[3]+t}}return e.__rect},isCover:e("./normalIsCover")},n.inherits(t,i),t}),i("zrender/tool/computeBoundingBox",["require","./vector","./curve"],function(e){function t(e,t,i){if(0!==e.length){for(var n=e[0][0],a=e[0][0],o=e[0][1],r=e[0][1],s=1;s'+(t[0]||this._lang[0])+"
";var i=this.query(this.option,"toolbox.feature.dataView.optionToContent");"function"!=typeof i?this._textArea.value=this._optionToContent():(this._textArea=document.createElement("div"),this._textArea.innerHTML=i(this.option)),this._textArea.style.cssText="display:block;margin:0 0 8px 0;padding:4px 6px;overflow:auto;width:100%;height:"+(this._zrHeight-100)+"px;",this._tDom.appendChild(this._textArea),this._buttonClose.style.cssText="float:right;padding:1px 6px;",this._buttonClose.innerHTML=t[1]||this._lang[1];var n=this;this._buttonClose.onclick=function(){n.hide()},this._tDom.appendChild(this._buttonClose),this.query(this.option,"toolbox.feature.dataView.readOnly")===!1?(this._buttonRefresh.style.cssText="float:right;margin-right:10px;padding:1px 6px;",this._buttonRefresh.innerHTML=t[2]||this._lang[2],this._buttonRefresh.onclick=function(){n._save()},this._textArea.readOnly=!1,this._textArea.style.cursor="default"):(this._buttonRefresh.style.cssText="display:none",this._textArea.readOnly=!0,this._textArea.style.cursor="text"),this._tDom.appendChild(this._buttonRefresh),this._sizeCssText="width:"+this._zrWidth+"px;height:"+this._zrHeight+"px;background-color:#fff;",this._tDom.style.cssText=this._gCssText+this._sizeCssText},_optionToContent:function(){var e,t,i,a,o,r,s=[],l="";if(this.option.xAxis)for(s=this.option.xAxis instanceof Array?this.option.xAxis:[this.option.xAxis],e=0,a=s.length;a>e;e++)if("category"==(s[e].type||"category")){for(r=[],t=0,i=s[e].data.length;i>t;t++)r.push(this.getDataFromOption(s[e].data[t]));l+=r.join(", ")+"\n\n"}if(this.option.yAxis)for(s=this.option.yAxis instanceof Array?this.option.yAxis:[this.option.yAxis],e=0,a=s.length;a>e;e++)if("category"==s[e].type){for(r=[],t=0,i=s[e].data.length;i>t;t++)r.push(this.getDataFromOption(s[e].data[t]));l+=r.join(", ")+"\n\n"}var h,d=this.option.series;for(e=0,a=d.length;a>e;e++){for(r=[],t=0,i=d[e].data.length;i>t;t++)o=d[e].data[t],h=d[e].type==n.CHART_TYPE_PIE||d[e].type==n.CHART_TYPE_MAP?(o.name||"-")+":":"",d[e].type==n.CHART_TYPE_SCATTER&&(o=this.getDataFromOption(o).join(", ")),r.push(h+this.getDataFromOption(o));l+=(d[e].name||"-")+" : \n",l+=r.join(d[e].type==n.CHART_TYPE_SCATTER?"\n":", "),l+="\n\n"}return l},_save:function(){var e=this.query(this.option,"toolbox.feature.dataView.contentToOption");if("function"!=typeof e){for(var t=this._textArea.value.split("\n"),i=[],a=0,o=t.length;o>a;a++)t[a]=this._trim(t[a]),""!==t[a]&&i.push(t[a]);this._contentToOption(i)}else e(this._textArea,this.option);this.hide();var r=this;setTimeout(function(){r.messageCenter&&r.messageCenter.dispatch(n.EVENT.DATA_VIEW_CHANGED,null,{option:r.option},r.myChart)},r.canvasSupported?800:100)},_contentToOption:function(e){var t,i,a,o,r,s,l,h=[],d=0;if(this.option.xAxis)for(h=this.option.xAxis instanceof Array?this.option.xAxis:[this.option.xAxis],t=0,o=h.length;o>t;t++)if("category"==(h[t].type||"category")){for(s=e[d].split(","),i=0,a=h[t].data.length;a>i;i++)l=this._trim(s[i]||""),r=h[t].data[i],"undefined"!=typeof h[t].data[i].value?h[t].data[i].value=l:h[t].data[i]=l;d++}if(this.option.yAxis)for(h=this.option.yAxis instanceof Array?this.option.yAxis:[this.option.yAxis],t=0,o=h.length;o>t;t++)if("category"==h[t].type){for(s=e[d].split(","),i=0,a=h[t].data.length;a>i;i++)l=this._trim(s[i]||""),r=h[t].data[i],"undefined"!=typeof h[t].data[i].value?h[t].data[i].value=l:h[t].data[i]=l;d++}var c=this.option.series;for(t=0,o=c.length;o>t;t++)if(d++,c[t].type==n.CHART_TYPE_SCATTER)for(var i=0,a=c[t].data.length;a>i;i++)s=e[d],l=s.replace(" ","").split(","),"undefined"!=typeof c[t].data[i].value?c[t].data[i].value=l:c[t].data[i]=l,d++;else{s=e[d].split(",");for(var i=0,a=c[t].data.length;a>i;i++)l=(s[i]||"").replace(/.*:/,""),l=this._trim(l),l="-"!=l&&""!==l?l-0:"-","undefined"!=typeof c[t].data[i].value?c[t].data[i].value=l:c[t].data[i]=l;d++}},_trim:function(e){var t=new RegExp("(^[\\s\\t\\xa0\\u3000]+)|([\\u3000\\xa0\\s\\t]+$)","g");return e.replace(t,"")},_stop:function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},resize:function(){this._zrHeight=this.zr.getHeight(),this._zrWidth=this.zr.getWidth(),this._tDom.offsetHeight>10&&(this._sizeCssText="width:"+this._zrWidth+"px;height:"+this._zrHeight+"px;background-color:#fff;",this._tDom.style.cssText=this._gCssText+this._sizeCssText,this._textArea.style.cssText="display:block;margin:0 0 8px 0;padding:4px 6px;overflow:auto;width:100%;height:"+(this._zrHeight-100)+"px;")},dispose:function(){window.removeEventListener?(this._tDom.removeEventListener("click",this._stop),this._tDom.removeEventListener("mousewheel",this._stop),this._tDom.removeEventListener("mousemove",this._stop),this._tDom.removeEventListener("mousedown",this._stop),this._tDom.removeEventListener("mouseup",this._stop),this._tDom.removeEventListener("touchstart",this._stop),this._tDom.removeEventListener("touchmove",this._stop),this._tDom.removeEventListener("touchend",this._stop)):(this._tDom.detachEvent("onclick",this._stop),this._tDom.detachEvent("onmousewheel",this._stop),this._tDom.detachEvent("onmousemove",this._stop),this._tDom.detachEvent("onmousedown",this._stop),this._tDom.detachEvent("onmouseup",this._stop)),this._buttonRefresh.onclick=null,this._buttonClose.onclick=null,this._hasShow&&(this._tDom.removeChild(this._textArea),this._tDom.removeChild(this._buttonRefresh),this._tDom.removeChild(this._buttonClose)),this._textArea=null,this._buttonRefresh=null,this._buttonClose=null,this.dom.firstChild.removeChild(this._tDom),this._tDom=null}},a.inherits(t,i),e("../component").define("dataView",t),t}),define("echarts/util/shape/Cross",["require","zrender/shape/Base","zrender/shape/Line","zrender/tool/util","./normalIsCover"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/shape/Line"),a=e("zrender/tool/util");return t.prototype={type:"cross",buildPath:function(e,t){var i=t.rect;t.xStart=i.x,t.xEnd=i.x+i.width,t.yStart=t.yEnd=t.y,n.prototype.buildPath(e,t),t.xStart=t.xEnd=t.x,t.yStart=i.y,t.yEnd=i.y+i.height,n.prototype.buildPath(e,t)},getRect:function(e){return e.rect},isCover:e("./normalIsCover")},a.inherits(t,i),t}),define("zrender/shape/Sector",["require","../tool/math","../tool/computeBoundingBox","../tool/vector","./Base","../tool/util"],function(e){var t=e("../tool/math"),i=e("../tool/computeBoundingBox"),n=e("../tool/vector"),a=e("./Base"),o=n.create(),r=n.create(),s=n.create(),l=n.create(),h=function(e){a.call(this,e)};return h.prototype={type:"sector",buildPath:function(e,i){var n=i.x,a=i.y,o=i.r0||0,r=i.r,s=i.startAngle,l=i.endAngle,h=i.clockWise||!1;s=t.degreeToRadian(s),l=t.degreeToRadian(l),h||(s=-s,l=-l);var d=t.cos(s),c=t.sin(s);e.moveTo(d*o+n,c*o+a),e.lineTo(d*r+n,c*r+a),e.arc(n,a,r,s,l,!h),e.lineTo(t.cos(l)*o+n,t.sin(l)*o+a),0!==o&&e.arc(n,a,o,l,s,h),e.closePath()},getRect:function(e){if(e.__rect)return e.__rect;var a=e.x,h=e.y,d=e.r0||0,c=e.r,m=t.degreeToRadian(e.startAngle),p=t.degreeToRadian(e.endAngle),u=e.clockWise;return u||(m=-m,p=-p),d>1?i.arc(a,h,d,m,p,!u,o,s):(o[0]=s[0]=a,o[1]=s[1]=h),i.arc(a,h,c,m,p,!u,r,l),n.min(o,o,r),n.max(s,s,l),e.__rect={x:o[0],y:o[1],width:s[0]-o[0],height:s[1]-o[1]},e.__rect}},e("../tool/util").inherits(h,a),h}),define("echarts/util/shape/Candle",["require","zrender/shape/Base","zrender/tool/util","./normalIsCover"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/tool/util");return t.prototype={type:"candle",_numberOrder:function(e,t){return t-e},buildPath:function(e,t){var i=n.clone(t.y).sort(this._numberOrder);e.moveTo(t.x,i[3]),e.lineTo(t.x,i[2]),e.moveTo(t.x-t.width/2,i[2]),e.rect(t.x-t.width/2,i[2],t.width,i[1]-i[2]),e.moveTo(t.x,i[1]),e.lineTo(t.x,i[0])},getRect:function(e){if(!e.__rect){var t=0;("stroke"==e.brushType||"fill"==e.brushType)&&(t=e.lineWidth||1);var i=n.clone(e.y).sort(this._numberOrder);e.__rect={x:Math.round(e.x-e.width/2-t/2),y:Math.round(i[3]-t/2),width:e.width+t,height:i[0]-i[3]+t}}return e.__rect},isCover:e("./normalIsCover")},n.inherits(t,i),t}),define("zrender/tool/computeBoundingBox",["require","./vector","./curve"],function(e){function t(e,t,i){if(0!==e.length){for(var n=e[0][0],a=e[0][0],o=e[0][1],r=e[0][1],s=1;s