From 7ed8bbfdb8445b6402b0eb0e4e745e93b6ef17e4 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 18:49:46 -0600 Subject: [PATCH 01/11] reports an exception in Mix to be handled on a case by case basis --- src/Illuminate/Foundation/helpers.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 3360a9e980df..9d41ece2f5ce 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -568,11 +568,17 @@ function mix($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; - if (! isset($manifest[$path])) { - throw new Exception( - "Unable to locate Mix file: {$path}. Please check your ". - 'webpack.mix.js output paths and try again.' - ); + if ( ! isset($manifest[$path])) { + + $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; + + report(new Exception($mixMessage)); + + if (app('config')->get('app.debug')) { + app('log')->info($mixMessage); + + return $path; + } } return new HtmlString($manifestDirectory.$manifest[$path]); From 97d0d3cf0d2f657ebcf1477ec2e3d2eb7047307e Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 21:58:45 -0600 Subject: [PATCH 02/11] . --- src/Illuminate/Foundation/helpers.php | 415 ++++++++++++++------------ 1 file changed, 232 insertions(+), 183 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 37e4f93d11fc..70e97d6d47ba 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -15,13 +15,14 @@ use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory; -if (! function_exists('abort')) { +if ( ! function_exists('abort')) { /** * Throw an HttpException with the given data. * - * @param int $code - * @param string $message - * @param array $headers + * @param int $code + * @param string $message + * @param array $headers + * * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -33,14 +34,15 @@ function abort($code, $message = '', array $headers = []) } } -if (! function_exists('abort_if')) { +if ( ! function_exists('abort_if')) { /** * Throw an HttpException with the given data if the given condition is true. * - * @param bool $boolean - * @param int $code - * @param string $message - * @param array $headers + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -54,14 +56,15 @@ function abort_if($boolean, $code, $message = '', array $headers = []) } } -if (! function_exists('abort_unless')) { +if ( ! function_exists('abort_unless')) { /** * Throw an HttpException with the given data unless the given condition is true. * - * @param bool $boolean - * @param int $code - * @param string $message - * @param array $headers + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -69,19 +72,20 @@ function abort_if($boolean, $code, $message = '', array $headers = []) */ function abort_unless($boolean, $code, $message = '', array $headers = []) { - if (! $boolean) { + if ( ! $boolean) { abort($code, $message, $headers); } } } -if (! function_exists('action')) { +if ( ! function_exists('action')) { /** * Generate the URL to a controller action. * - * @param string $name - * @param array $parameters - * @param bool $absolute + * @param string $name + * @param array $parameters + * @param bool $absolute + * * @return string */ function action($name, $parameters = [], $absolute = true) @@ -90,12 +94,13 @@ function action($name, $parameters = [], $absolute = true) } } -if (! function_exists('app')) { +if ( ! function_exists('app')) { /** * Get the available container instance. * - * @param string $abstract - * @param array $parameters + * @param string $abstract + * @param array $parameters + * * @return mixed|\Illuminate\Foundation\Application */ function app($abstract = null, array $parameters = []) @@ -104,31 +109,32 @@ function app($abstract = null, array $parameters = []) return Container::getInstance(); } - return empty($parameters) - ? Container::getInstance()->make($abstract) - : Container::getInstance()->makeWith($abstract, $parameters); + return empty($parameters) ? Container::getInstance()->make($abstract) : Container::getInstance()->makeWith($abstract, + $parameters); } } -if (! function_exists('app_path')) { +if ( ! function_exists('app_path')) { /** * Get the path to the application folder. * - * @param string $path + * @param string $path + * * @return string */ function app_path($path = '') { - return app('path').($path ? DIRECTORY_SEPARATOR.$path : $path); + return app('path') . ($path ? DIRECTORY_SEPARATOR . $path : $path); } } -if (! function_exists('asset')) { +if ( ! function_exists('asset')) { /** * Generate an asset path for the application. * - * @param string $path - * @param bool $secure + * @param string $path + * @param bool $secure + * * @return string */ function asset($path, $secure = null) @@ -137,11 +143,12 @@ function asset($path, $secure = null) } } -if (! function_exists('auth')) { +if ( ! function_exists('auth')) { /** * Get the available auth instance. * - * @param string|null $guard + * @param string|null $guard + * * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard */ function auth($guard = null) @@ -154,13 +161,14 @@ function auth($guard = null) } } -if (! function_exists('back')) { +if ( ! function_exists('back')) { /** * Create a new redirect response to the previous location. * - * @param int $status - * @param array $headers - * @param mixed $fallback + * @param int $status + * @param array $headers + * @param mixed $fallback + * * @return \Illuminate\Http\RedirectResponse */ function back($status = 302, $headers = [], $fallback = false) @@ -169,25 +177,27 @@ function back($status = 302, $headers = [], $fallback = false) } } -if (! function_exists('base_path')) { +if ( ! function_exists('base_path')) { /** * Get the path to the base of the install. * - * @param string $path + * @param string $path + * * @return string */ function base_path($path = '') { - return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path); + return app()->basePath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); } } -if (! function_exists('bcrypt')) { +if ( ! function_exists('bcrypt')) { /** * Hash the given value. * - * @param string $value - * @param array $options + * @param string $value + * @param array $options + * * @return string */ function bcrypt($value, $options = []) @@ -196,11 +206,12 @@ function bcrypt($value, $options = []) } } -if (! function_exists('broadcast')) { +if ( ! function_exists('broadcast')) { /** * Begin broadcasting an event. * - * @param mixed|null $event + * @param mixed|null $event + * * @return \Illuminate\Broadcasting\PendingBroadcast|void */ function broadcast($event = null) @@ -209,13 +220,14 @@ function broadcast($event = null) } } -if (! function_exists('cache')) { +if ( ! function_exists('cache')) { /** * Get / set the specified cache value. * * If an array is passed, we'll assume you want to put to the cache. * * @param dynamic key|key,default|data,expiration|null + * * @return mixed * * @throws \Exception @@ -232,30 +244,27 @@ function cache() return app('cache')->get($arguments[0], $arguments[1] ?? null); } - if (! is_array($arguments[0])) { - throw new Exception( - 'When setting a value in the cache, you must pass an array of key / value pairs.' - ); + if ( ! is_array($arguments[0])) { + throw new Exception('When setting a value in the cache, you must pass an array of key / value pairs.'); } - if (! isset($arguments[1])) { - throw new Exception( - 'You must specify an expiration time when setting a value in the cache.' - ); + if ( ! isset($arguments[1])) { + throw new Exception('You must specify an expiration time when setting a value in the cache.'); } return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1]); } } -if (! function_exists('config')) { +if ( ! function_exists('config')) { /** * Get / set the specified configuration value. * * If an array is passed as the key, we will assume you want to set an array of values. * - * @param array|string $key - * @param mixed $default + * @param array|string $key + * @param mixed $default + * * @return mixed */ function config($key = null, $default = null) @@ -272,34 +281,43 @@ function config($key = null, $default = null) } } -if (! function_exists('config_path')) { +if ( ! function_exists('config_path')) { /** * Get the configuration path. * - * @param string $path + * @param string $path + * * @return string */ function config_path($path = '') { - return app()->make('path.config').($path ? DIRECTORY_SEPARATOR.$path : $path); + return app()->make('path.config') . ($path ? DIRECTORY_SEPARATOR . $path : $path); } } -if (! function_exists('cookie')) { +if ( ! function_exists('cookie')) { /** * Create a new cookie instance. * - * @param string $name - * @param string $value - * @param int $minutes - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * * @return \Symfony\Component\HttpFoundation\Cookie */ - function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) - { + function cookie( + $name = null, + $value = null, + $minutes = 0, + $path = null, + $domain = null, + $secure = false, + $httpOnly = true + ) { $cookie = app(CookieFactory::class); if (is_null($name)) { @@ -310,7 +328,7 @@ function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain } } -if (! function_exists('csrf_field')) { +if ( ! function_exists('csrf_field')) { /** * Generate a CSRF token form field. * @@ -318,11 +336,11 @@ function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain */ function csrf_field() { - return new HtmlString(''); + return new HtmlString(''); } } -if (! function_exists('csrf_token')) { +if ( ! function_exists('csrf_token')) { /** * Get the CSRF token value. * @@ -342,11 +360,12 @@ function csrf_token() } } -if (! function_exists('database_path')) { +if ( ! function_exists('database_path')) { /** * Get the database path. * - * @param string $path + * @param string $path + * * @return string */ function database_path($path = '') @@ -355,11 +374,12 @@ function database_path($path = '') } } -if (! function_exists('decrypt')) { +if ( ! function_exists('decrypt')) { /** * Decrypt the given value. * - * @param string $value + * @param string $value + * * @return string */ function decrypt($value) @@ -368,11 +388,12 @@ function decrypt($value) } } -if (! function_exists('dispatch')) { +if ( ! function_exists('dispatch')) { /** * Dispatch a job to its appropriate handler. * - * @param mixed $job + * @param mixed $job + * * @return \Illuminate\Foundation\Bus\PendingDispatch */ function dispatch($job) @@ -381,12 +402,13 @@ function dispatch($job) } } -if (! function_exists('dispatch_now')) { +if ( ! function_exists('dispatch_now')) { /** * Dispatch a command to its appropriate handler in the current process. * - * @param mixed $job - * @param mixed $handler + * @param mixed $job + * @param mixed $handler + * * @return mixed */ function dispatch_now($job, $handler = null) @@ -395,12 +417,13 @@ function dispatch_now($job, $handler = null) } } -if (! function_exists('elixir')) { +if ( ! function_exists('elixir')) { /** * Get the path to a versioned Elixir file. * - * @param string $file - * @param string $buildDirectory + * @param string $file + * @param string $buildDirectory + * * @return string * * @throws \InvalidArgumentException @@ -411,10 +434,10 @@ function elixir($file, $buildDirectory = 'build') static $manifestPath; if (empty($manifest) || $manifestPath !== $buildDirectory) { - $path = public_path($buildDirectory.'/rev-manifest.json'); + $path = public_path($buildDirectory . '/rev-manifest.json'); if (file_exists($path)) { - $manifest = json_decode(file_get_contents($path), true); + $manifest = json_decode(file_get_contents($path), true); $manifestPath = $buildDirectory; } } @@ -422,24 +445,25 @@ function elixir($file, $buildDirectory = 'build') $file = ltrim($file, '/'); if (isset($manifest[$file])) { - return '/'.trim($buildDirectory.'/'.$manifest[$file], '/'); + return '/' . trim($buildDirectory . '/' . $manifest[$file], '/'); } $unversioned = public_path($file); if (file_exists($unversioned)) { - return '/'.trim($file, '/'); + return '/' . trim($file, '/'); } throw new InvalidArgumentException("File {$file} not defined in asset manifest."); } } -if (! function_exists('encrypt')) { +if ( ! function_exists('encrypt')) { /** * Encrypt the given value. * - * @param mixed $value + * @param mixed $value + * * @return string */ function encrypt($value) @@ -448,13 +472,14 @@ function encrypt($value) } } -if (! function_exists('event')) { +if ( ! function_exists('event')) { /** * Dispatch an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * * @return array|null */ function event(...$args) @@ -463,11 +488,12 @@ function event(...$args) } } -if (! function_exists('factory')) { +if ( ! function_exists('factory')) { /** * Create a model factory builder for a given class, name, and amount. * * @param dynamic class|class,name|class,amount|class,name,amount + * * @return \Illuminate\Database\Eloquent\FactoryBuilder */ function factory() @@ -486,12 +512,13 @@ function factory() } } -if (! function_exists('info')) { +if ( ! function_exists('info')) { /** * Write some information to the log. * - * @param string $message - * @param array $context + * @param string $message + * @param array $context + * * @return void */ function info($message, $context = []) @@ -500,12 +527,13 @@ function info($message, $context = []) } } -if (! function_exists('logger')) { +if ( ! function_exists('logger')) { /** * Log a debug message to the logs. * - * @param string $message - * @param array $context + * @param string $message + * @param array $context + * * @return \Illuminate\Contracts\Logging\Log|null */ function logger($message = null, array $context = []) @@ -518,25 +546,27 @@ function logger($message = null, array $context = []) } } -if (! function_exists('method_field')) { +if ( ! function_exists('method_field')) { /** * Generate a form field to spoof the HTTP verb used by forms. * - * @param string $method + * @param string $method + * * @return \Illuminate\Support\HtmlString */ function method_field($method) { - return new HtmlString(''); + return new HtmlString(''); } } -if (! function_exists('mix')) { +if ( ! function_exists('mix')) { /** * Get the path to a versioned Mix file. * - * @param string $path - * @param string $manifestDirectory + * @param string $path + * @param string $manifestDirectory + * * @return \Illuminate\Support\HtmlString * * @throws \Exception @@ -545,7 +575,7 @@ function mix($path, $manifestDirectory = '') { static $manifests = []; - if (! starts_with($path, '/')) { + if ( ! starts_with($path, '/')) { $path = "/{$path}"; } @@ -553,14 +583,14 @@ function mix($path, $manifestDirectory = '') $manifestDirectory = "/{$manifestDirectory}"; } - if (file_exists(public_path($manifestDirectory.'/hot'))) { + if (file_exists(public_path($manifestDirectory . '/hot'))) { return new HtmlString("//localhost:8080{$path}"); } - $manifestPath = public_path($manifestDirectory.'/mix-manifest.json'); + $manifestPath = public_path($manifestDirectory . '/mix-manifest.json'); - if (! isset($manifests[$manifestPath])) { - if (! file_exists($manifestPath)) { + if ( ! isset($manifests[$manifestPath])) { + if ( ! file_exists($manifestPath)) { throw new Exception('The Mix manifest does not exist.'); } @@ -574,24 +604,24 @@ function mix($path, $manifestDirectory = '') $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); - - if (app('config')->get('app.debug')) { + if ( ! app('config')->get('app.debug')) { app('log')->info($mixMessage); return $path; } } - return new HtmlString($manifestDirectory.$manifest[$path]); + return new HtmlString($manifestDirectory . $manifest[$path]); } } -if (! function_exists('old')) { +if ( ! function_exists('old')) { /** * Retrieve an old input item. * - * @param string $key - * @param mixed $default + * @param string $key + * @param mixed $default + * * @return mixed */ function old($key = null, $default = null) @@ -600,11 +630,12 @@ function old($key = null, $default = null) } } -if (! function_exists('policy')) { +if ( ! function_exists('policy')) { /** * Get a policy instance for a given class. * - * @param object|string $class + * @param object|string $class + * * @return mixed * * @throws \InvalidArgumentException @@ -615,27 +646,29 @@ function policy($class) } } -if (! function_exists('public_path')) { +if ( ! function_exists('public_path')) { /** * Get the path to the public folder. * - * @param string $path + * @param string $path + * * @return string */ function public_path($path = '') { - return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); + return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); } } -if (! function_exists('redirect')) { +if ( ! function_exists('redirect')) { /** * Get an instance of the redirector. * - * @param string|null $to - * @param int $status - * @param array $headers - * @param bool $secure + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool $secure + * * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse */ function redirect($to = null, $status = 302, $headers = [], $secure = null) @@ -648,11 +681,12 @@ function redirect($to = null, $status = 302, $headers = [], $secure = null) } } -if (! function_exists('report')) { +if ( ! function_exists('report')) { /** * Report an exception. * - * @param \Exception $e + * @param \Exception $e + * * @return void */ function report($exception) @@ -661,12 +695,13 @@ function report($exception) } } -if (! function_exists('request')) { +if ( ! function_exists('request')) { /** * Get an instance of the current request or an input item from the request. * - * @param array|string $key - * @param mixed $default + * @param array|string $key + * @param mixed $default + * * @return \Illuminate\Http\Request|string|array */ function request($key = null, $default = null) @@ -685,11 +720,12 @@ function request($key = null, $default = null) } } -if (! function_exists('resolve')) { +if ( ! function_exists('resolve')) { /** * Resolve a service from the container. * - * @param string $name + * @param string $name + * * @return mixed */ function resolve($name) @@ -698,11 +734,12 @@ function resolve($name) } } -if (! function_exists('resource_path')) { +if ( ! function_exists('resource_path')) { /** * Get the path to the resources folder. * - * @param string $path + * @param string $path + * * @return string */ function resource_path($path = '') @@ -711,13 +748,14 @@ function resource_path($path = '') } } -if (! function_exists('response')) { +if ( ! function_exists('response')) { /** * Return a new response from the application. * - * @param string $content - * @param int $status - * @param array $headers + * @param string $content + * @param int $status + * @param array $headers + * * @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory */ function response($content = '', $status = 200, array $headers = []) @@ -732,13 +770,14 @@ function response($content = '', $status = 200, array $headers = []) } } -if (! function_exists('route')) { +if ( ! function_exists('route')) { /** * Generate the URL to a named route. * - * @param string $name - * @param array $parameters - * @param bool $absolute + * @param string $name + * @param array $parameters + * @param bool $absolute + * * @return string */ function route($name, $parameters = [], $absolute = true) @@ -747,11 +786,12 @@ function route($name, $parameters = [], $absolute = true) } } -if (! function_exists('secure_asset')) { +if ( ! function_exists('secure_asset')) { /** * Generate an asset path for the application. * - * @param string $path + * @param string $path + * * @return string */ function secure_asset($path) @@ -760,12 +800,13 @@ function secure_asset($path) } } -if (! function_exists('secure_url')) { +if ( ! function_exists('secure_url')) { /** * Generate a HTTPS url for the application. * - * @param string $path - * @param mixed $parameters + * @param string $path + * @param mixed $parameters + * * @return string */ function secure_url($path, $parameters = []) @@ -774,14 +815,15 @@ function secure_url($path, $parameters = []) } } -if (! function_exists('session')) { +if ( ! function_exists('session')) { /** * Get / set the specified session value. * * If an array is passed as the key, we will assume you want to set an array of values. * - * @param array|string $key - * @param mixed $default + * @param array|string $key + * @param mixed $default + * * @return mixed */ function session($key = null, $default = null) @@ -798,26 +840,28 @@ function session($key = null, $default = null) } } -if (! function_exists('storage_path')) { +if ( ! function_exists('storage_path')) { /** * Get the path to the storage folder. * - * @param string $path + * @param string $path + * * @return string */ function storage_path($path = '') { - return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); + return app('path.storage') . ($path ? DIRECTORY_SEPARATOR . $path : $path); } } -if (! function_exists('trans')) { +if ( ! function_exists('trans')) { /** * Translate the given message. * - * @param string $key - * @param array $replace - * @param string $locale + * @param string $key + * @param array $replace + * @param string $locale + * * @return \Illuminate\Contracts\Translation\Translator|string|array|null */ function trans($key = null, $replace = [], $locale = null) @@ -830,14 +874,15 @@ function trans($key = null, $replace = [], $locale = null) } } -if (! function_exists('trans_choice')) { +if ( ! function_exists('trans_choice')) { /** * Translates the given message based on a count. * - * @param string $key - * @param int|array|\Countable $number - * @param array $replace - * @param string $locale + * @param string $key + * @param int|array|\Countable $number + * @param array $replace + * @param string $locale + * * @return string */ function trans_choice($key, $number, array $replace = [], $locale = null) @@ -846,13 +891,14 @@ function trans_choice($key, $number, array $replace = [], $locale = null) } } -if (! function_exists('__')) { +if ( ! function_exists('__')) { /** * Translate the given message. * - * @param string $key - * @param array $replace - * @param string $locale + * @param string $key + * @param array $replace + * @param string $locale + * * @return \Illuminate\Contracts\Translation\Translator|string */ function __($key = null, $replace = [], $locale = null) @@ -861,13 +907,14 @@ function __($key = null, $replace = [], $locale = null) } } -if (! function_exists('url')) { +if ( ! function_exists('url')) { /** * Generate a url for the application. * - * @param string $path - * @param mixed $parameters - * @param bool $secure + * @param string $path + * @param mixed $parameters + * @param bool $secure + * * @return \Illuminate\Contracts\Routing\UrlGenerator|string */ function url($path = null, $parameters = [], $secure = null) @@ -880,14 +927,15 @@ function url($path = null, $parameters = [], $secure = null) } } -if (! function_exists('validator')) { +if ( ! function_exists('validator')) { /** * Create a new Validator instance. * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * * @return \Illuminate\Contracts\Validation\Validator */ function validator(array $data = [], array $rules = [], array $messages = [], array $customAttributes = []) @@ -902,13 +950,14 @@ function validator(array $data = [], array $rules = [], array $messages = [], ar } } -if (! function_exists('view')) { +if ( ! function_exists('view')) { /** * Get the evaluated view contents for the given view. * - * @param string $view - * @param array $data - * @param array $mergeData + * @param string $view + * @param array $data + * @param array $mergeData + * * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory */ function view($view = null, $data = [], $mergeData = []) From 4b1c935a8946f7939555db2c92c963b6bd251432 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 21:59:49 -0600 Subject: [PATCH 03/11] . --- src/Illuminate/Foundation/helpers.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 70e97d6d47ba..0337698a58f2 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -600,7 +600,6 @@ function mix($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; if ( ! isset($manifest[$path])) { - $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); From e77749417b65d4a30aa35fac4c88301fa446d653 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:00:15 -0600 Subject: [PATCH 04/11] . --- src/Illuminate/Foundation/helpers.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 0337698a58f2..70e97d6d47ba 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -600,6 +600,7 @@ function mix($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; if ( ! isset($manifest[$path])) { + $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); From 4a8cdce6489e823386334f08084ed8131c3728d3 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:03:23 -0600 Subject: [PATCH 05/11] . --- src/Illuminate/Foundation/helpers.php | 417 ++++++++++++-------------- 1 file changed, 184 insertions(+), 233 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 70e97d6d47ba..803a3206ba26 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -15,14 +15,13 @@ use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory; -if ( ! function_exists('abort')) { +if (! function_exists('abort')) { /** * Throw an HttpException with the given data. * - * @param int $code - * @param string $message - * @param array $headers - * + * @param int $code + * @param string $message + * @param array $headers * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -34,15 +33,14 @@ function abort($code, $message = '', array $headers = []) } } -if ( ! function_exists('abort_if')) { +if (! function_exists('abort_if')) { /** * Throw an HttpException with the given data if the given condition is true. * - * @param bool $boolean - * @param int $code - * @param string $message - * @param array $headers - * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -56,15 +54,14 @@ function abort_if($boolean, $code, $message = '', array $headers = []) } } -if ( ! function_exists('abort_unless')) { +if (! function_exists('abort_unless')) { /** * Throw an HttpException with the given data unless the given condition is true. * - * @param bool $boolean - * @param int $code - * @param string $message - * @param array $headers - * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers * @return void * * @throws \Symfony\Component\HttpKernel\Exception\HttpException @@ -72,20 +69,19 @@ function abort_if($boolean, $code, $message = '', array $headers = []) */ function abort_unless($boolean, $code, $message = '', array $headers = []) { - if ( ! $boolean) { + if (! $boolean) { abort($code, $message, $headers); } } } -if ( ! function_exists('action')) { +if (! function_exists('action')) { /** * Generate the URL to a controller action. * - * @param string $name - * @param array $parameters - * @param bool $absolute - * + * @param string $name + * @param array $parameters + * @param bool $absolute * @return string */ function action($name, $parameters = [], $absolute = true) @@ -94,13 +90,12 @@ function action($name, $parameters = [], $absolute = true) } } -if ( ! function_exists('app')) { +if (! function_exists('app')) { /** * Get the available container instance. * - * @param string $abstract - * @param array $parameters - * + * @param string $abstract + * @param array $parameters * @return mixed|\Illuminate\Foundation\Application */ function app($abstract = null, array $parameters = []) @@ -109,32 +104,31 @@ function app($abstract = null, array $parameters = []) return Container::getInstance(); } - return empty($parameters) ? Container::getInstance()->make($abstract) : Container::getInstance()->makeWith($abstract, - $parameters); + return empty($parameters) + ? Container::getInstance()->make($abstract) + : Container::getInstance()->makeWith($abstract, $parameters); } } -if ( ! function_exists('app_path')) { +if (! function_exists('app_path')) { /** * Get the path to the application folder. * - * @param string $path - * + * @param string $path * @return string */ function app_path($path = '') { - return app('path') . ($path ? DIRECTORY_SEPARATOR . $path : $path); + return app('path').($path ? DIRECTORY_SEPARATOR.$path : $path); } } -if ( ! function_exists('asset')) { +if (! function_exists('asset')) { /** * Generate an asset path for the application. * - * @param string $path - * @param bool $secure - * + * @param string $path + * @param bool $secure * @return string */ function asset($path, $secure = null) @@ -143,12 +137,11 @@ function asset($path, $secure = null) } } -if ( ! function_exists('auth')) { +if (! function_exists('auth')) { /** * Get the available auth instance. * - * @param string|null $guard - * + * @param string|null $guard * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard */ function auth($guard = null) @@ -161,14 +154,13 @@ function auth($guard = null) } } -if ( ! function_exists('back')) { +if (! function_exists('back')) { /** * Create a new redirect response to the previous location. * - * @param int $status - * @param array $headers - * @param mixed $fallback - * + * @param int $status + * @param array $headers + * @param mixed $fallback * @return \Illuminate\Http\RedirectResponse */ function back($status = 302, $headers = [], $fallback = false) @@ -177,27 +169,25 @@ function back($status = 302, $headers = [], $fallback = false) } } -if ( ! function_exists('base_path')) { +if (! function_exists('base_path')) { /** * Get the path to the base of the install. * - * @param string $path - * + * @param string $path * @return string */ function base_path($path = '') { - return app()->basePath() . ($path ? DIRECTORY_SEPARATOR . $path : $path); + return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path); } } -if ( ! function_exists('bcrypt')) { +if (! function_exists('bcrypt')) { /** * Hash the given value. * - * @param string $value - * @param array $options - * + * @param string $value + * @param array $options * @return string */ function bcrypt($value, $options = []) @@ -206,12 +196,11 @@ function bcrypt($value, $options = []) } } -if ( ! function_exists('broadcast')) { +if (! function_exists('broadcast')) { /** * Begin broadcasting an event. * - * @param mixed|null $event - * + * @param mixed|null $event * @return \Illuminate\Broadcasting\PendingBroadcast|void */ function broadcast($event = null) @@ -220,14 +209,13 @@ function broadcast($event = null) } } -if ( ! function_exists('cache')) { +if (! function_exists('cache')) { /** * Get / set the specified cache value. * * If an array is passed, we'll assume you want to put to the cache. * * @param dynamic key|key,default|data,expiration|null - * * @return mixed * * @throws \Exception @@ -244,27 +232,30 @@ function cache() return app('cache')->get($arguments[0], $arguments[1] ?? null); } - if ( ! is_array($arguments[0])) { - throw new Exception('When setting a value in the cache, you must pass an array of key / value pairs.'); + if (! is_array($arguments[0])) { + throw new Exception( + 'When setting a value in the cache, you must pass an array of key / value pairs.' + ); } - if ( ! isset($arguments[1])) { - throw new Exception('You must specify an expiration time when setting a value in the cache.'); + if (! isset($arguments[1])) { + throw new Exception( + 'You must specify an expiration time when setting a value in the cache.' + ); } return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1]); } } -if ( ! function_exists('config')) { +if (! function_exists('config')) { /** * Get / set the specified configuration value. * * If an array is passed as the key, we will assume you want to set an array of values. * - * @param array|string $key - * @param mixed $default - * + * @param array|string $key + * @param mixed $default * @return mixed */ function config($key = null, $default = null) @@ -281,43 +272,34 @@ function config($key = null, $default = null) } } -if ( ! function_exists('config_path')) { +if (! function_exists('config_path')) { /** * Get the configuration path. * - * @param string $path - * + * @param string $path * @return string */ function config_path($path = '') { - return app()->make('path.config') . ($path ? DIRECTORY_SEPARATOR . $path : $path); + return app()->make('path.config').($path ? DIRECTORY_SEPARATOR.$path : $path); } } -if ( ! function_exists('cookie')) { +if (! function_exists('cookie')) { /** * Create a new cookie instance. * - * @param string $name - * @param string $value - * @param int $minutes - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - * + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly * @return \Symfony\Component\HttpFoundation\Cookie */ - function cookie( - $name = null, - $value = null, - $minutes = 0, - $path = null, - $domain = null, - $secure = false, - $httpOnly = true - ) { + function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) + { $cookie = app(CookieFactory::class); if (is_null($name)) { @@ -328,7 +310,7 @@ function cookie( } } -if ( ! function_exists('csrf_field')) { +if (! function_exists('csrf_field')) { /** * Generate a CSRF token form field. * @@ -336,11 +318,11 @@ function cookie( */ function csrf_field() { - return new HtmlString(''); + return new HtmlString(''); } } -if ( ! function_exists('csrf_token')) { +if (! function_exists('csrf_token')) { /** * Get the CSRF token value. * @@ -360,12 +342,11 @@ function csrf_token() } } -if ( ! function_exists('database_path')) { +if (! function_exists('database_path')) { /** * Get the database path. * - * @param string $path - * + * @param string $path * @return string */ function database_path($path = '') @@ -374,12 +355,11 @@ function database_path($path = '') } } -if ( ! function_exists('decrypt')) { +if (! function_exists('decrypt')) { /** * Decrypt the given value. * - * @param string $value - * + * @param string $value * @return string */ function decrypt($value) @@ -388,12 +368,11 @@ function decrypt($value) } } -if ( ! function_exists('dispatch')) { +if (! function_exists('dispatch')) { /** * Dispatch a job to its appropriate handler. * - * @param mixed $job - * + * @param mixed $job * @return \Illuminate\Foundation\Bus\PendingDispatch */ function dispatch($job) @@ -402,13 +381,12 @@ function dispatch($job) } } -if ( ! function_exists('dispatch_now')) { +if (! function_exists('dispatch_now')) { /** * Dispatch a command to its appropriate handler in the current process. * - * @param mixed $job - * @param mixed $handler - * + * @param mixed $job + * @param mixed $handler * @return mixed */ function dispatch_now($job, $handler = null) @@ -417,13 +395,12 @@ function dispatch_now($job, $handler = null) } } -if ( ! function_exists('elixir')) { +if (! function_exists('elixir')) { /** * Get the path to a versioned Elixir file. * - * @param string $file - * @param string $buildDirectory - * + * @param string $file + * @param string $buildDirectory * @return string * * @throws \InvalidArgumentException @@ -434,10 +411,10 @@ function elixir($file, $buildDirectory = 'build') static $manifestPath; if (empty($manifest) || $manifestPath !== $buildDirectory) { - $path = public_path($buildDirectory . '/rev-manifest.json'); + $path = public_path($buildDirectory.'/rev-manifest.json'); if (file_exists($path)) { - $manifest = json_decode(file_get_contents($path), true); + $manifest = json_decode(file_get_contents($path), true); $manifestPath = $buildDirectory; } } @@ -445,25 +422,24 @@ function elixir($file, $buildDirectory = 'build') $file = ltrim($file, '/'); if (isset($manifest[$file])) { - return '/' . trim($buildDirectory . '/' . $manifest[$file], '/'); + return '/'.trim($buildDirectory.'/'.$manifest[$file], '/'); } $unversioned = public_path($file); if (file_exists($unversioned)) { - return '/' . trim($file, '/'); + return '/'.trim($file, '/'); } throw new InvalidArgumentException("File {$file} not defined in asset manifest."); } } -if ( ! function_exists('encrypt')) { +if (! function_exists('encrypt')) { /** * Encrypt the given value. * - * @param mixed $value - * + * @param mixed $value * @return string */ function encrypt($value) @@ -472,14 +448,13 @@ function encrypt($value) } } -if ( ! function_exists('event')) { +if (! function_exists('event')) { /** * Dispatch an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * + * @param string|object $event + * @param mixed $payload + * @param bool $halt * @return array|null */ function event(...$args) @@ -488,12 +463,11 @@ function event(...$args) } } -if ( ! function_exists('factory')) { +if (! function_exists('factory')) { /** * Create a model factory builder for a given class, name, and amount. * * @param dynamic class|class,name|class,amount|class,name,amount - * * @return \Illuminate\Database\Eloquent\FactoryBuilder */ function factory() @@ -512,13 +486,12 @@ function factory() } } -if ( ! function_exists('info')) { +if (! function_exists('info')) { /** * Write some information to the log. * - * @param string $message - * @param array $context - * + * @param string $message + * @param array $context * @return void */ function info($message, $context = []) @@ -527,13 +500,12 @@ function info($message, $context = []) } } -if ( ! function_exists('logger')) { +if (! function_exists('logger')) { /** * Log a debug message to the logs. * - * @param string $message - * @param array $context - * + * @param string $message + * @param array $context * @return \Illuminate\Contracts\Logging\Log|null */ function logger($message = null, array $context = []) @@ -546,27 +518,25 @@ function logger($message = null, array $context = []) } } -if ( ! function_exists('method_field')) { +if (! function_exists('method_field')) { /** * Generate a form field to spoof the HTTP verb used by forms. * - * @param string $method - * + * @param string $method * @return \Illuminate\Support\HtmlString */ function method_field($method) { - return new HtmlString(''); + return new HtmlString(''); } } -if ( ! function_exists('mix')) { +if (! function_exists('mix')) { /** * Get the path to a versioned Mix file. * - * @param string $path - * @param string $manifestDirectory - * + * @param string $path + * @param string $manifestDirectory * @return \Illuminate\Support\HtmlString * * @throws \Exception @@ -575,7 +545,7 @@ function mix($path, $manifestDirectory = '') { static $manifests = []; - if ( ! starts_with($path, '/')) { + if (! starts_with($path, '/')) { $path = "/{$path}"; } @@ -583,14 +553,14 @@ function mix($path, $manifestDirectory = '') $manifestDirectory = "/{$manifestDirectory}"; } - if (file_exists(public_path($manifestDirectory . '/hot'))) { + if (file_exists(public_path($manifestDirectory.'/hot'))) { return new HtmlString("//localhost:8080{$path}"); } - $manifestPath = public_path($manifestDirectory . '/mix-manifest.json'); + $manifestPath = public_path($manifestDirectory.'/mix-manifest.json'); - if ( ! isset($manifests[$manifestPath])) { - if ( ! file_exists($manifestPath)) { + if (! isset($manifests[$manifestPath])) { + if (! file_exists($manifestPath)) { throw new Exception('The Mix manifest does not exist.'); } @@ -599,29 +569,29 @@ function mix($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; - if ( ! isset($manifest[$path])) { + if (! isset($manifest[$path])) { $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); - if ( ! app('config')->get('app.debug')) { + + if (! app('config')->get('app.debug')) { app('log')->info($mixMessage); return $path; } } - return new HtmlString($manifestDirectory . $manifest[$path]); + return new HtmlString($manifestDirectory.$manifest[$path]); } } -if ( ! function_exists('old')) { +if (! function_exists('old')) { /** * Retrieve an old input item. * - * @param string $key - * @param mixed $default - * + * @param string $key + * @param mixed $default * @return mixed */ function old($key = null, $default = null) @@ -630,12 +600,11 @@ function old($key = null, $default = null) } } -if ( ! function_exists('policy')) { +if (! function_exists('policy')) { /** * Get a policy instance for a given class. * - * @param object|string $class - * + * @param object|string $class * @return mixed * * @throws \InvalidArgumentException @@ -646,29 +615,27 @@ function policy($class) } } -if ( ! function_exists('public_path')) { +if (! function_exists('public_path')) { /** * Get the path to the public folder. * - * @param string $path - * + * @param string $path * @return string */ function public_path($path = '') { - return app()->make('path.public') . ($path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : $path); + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); } } -if ( ! function_exists('redirect')) { +if (! function_exists('redirect')) { /** * Get an instance of the redirector. * - * @param string|null $to - * @param int $status - * @param array $headers - * @param bool $secure - * + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool $secure * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse */ function redirect($to = null, $status = 302, $headers = [], $secure = null) @@ -681,12 +648,11 @@ function redirect($to = null, $status = 302, $headers = [], $secure = null) } } -if ( ! function_exists('report')) { +if (! function_exists('report')) { /** * Report an exception. * - * @param \Exception $e - * + * @param \Exception $e * @return void */ function report($exception) @@ -695,13 +661,12 @@ function report($exception) } } -if ( ! function_exists('request')) { +if (! function_exists('request')) { /** * Get an instance of the current request or an input item from the request. * - * @param array|string $key - * @param mixed $default - * + * @param array|string $key + * @param mixed $default * @return \Illuminate\Http\Request|string|array */ function request($key = null, $default = null) @@ -720,12 +685,11 @@ function request($key = null, $default = null) } } -if ( ! function_exists('resolve')) { +if (! function_exists('resolve')) { /** * Resolve a service from the container. * - * @param string $name - * + * @param string $name * @return mixed */ function resolve($name) @@ -734,12 +698,11 @@ function resolve($name) } } -if ( ! function_exists('resource_path')) { +if (! function_exists('resource_path')) { /** * Get the path to the resources folder. * - * @param string $path - * + * @param string $path * @return string */ function resource_path($path = '') @@ -748,14 +711,13 @@ function resource_path($path = '') } } -if ( ! function_exists('response')) { +if (! function_exists('response')) { /** * Return a new response from the application. * - * @param string $content - * @param int $status - * @param array $headers - * + * @param string $content + * @param int $status + * @param array $headers * @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory */ function response($content = '', $status = 200, array $headers = []) @@ -770,14 +732,13 @@ function response($content = '', $status = 200, array $headers = []) } } -if ( ! function_exists('route')) { +if (! function_exists('route')) { /** * Generate the URL to a named route. * - * @param string $name - * @param array $parameters - * @param bool $absolute - * + * @param string $name + * @param array $parameters + * @param bool $absolute * @return string */ function route($name, $parameters = [], $absolute = true) @@ -786,12 +747,11 @@ function route($name, $parameters = [], $absolute = true) } } -if ( ! function_exists('secure_asset')) { +if (! function_exists('secure_asset')) { /** * Generate an asset path for the application. * - * @param string $path - * + * @param string $path * @return string */ function secure_asset($path) @@ -800,13 +760,12 @@ function secure_asset($path) } } -if ( ! function_exists('secure_url')) { +if (! function_exists('secure_url')) { /** * Generate a HTTPS url for the application. * - * @param string $path - * @param mixed $parameters - * + * @param string $path + * @param mixed $parameters * @return string */ function secure_url($path, $parameters = []) @@ -815,15 +774,14 @@ function secure_url($path, $parameters = []) } } -if ( ! function_exists('session')) { +if (! function_exists('session')) { /** * Get / set the specified session value. * * If an array is passed as the key, we will assume you want to set an array of values. * - * @param array|string $key - * @param mixed $default - * + * @param array|string $key + * @param mixed $default * @return mixed */ function session($key = null, $default = null) @@ -840,28 +798,26 @@ function session($key = null, $default = null) } } -if ( ! function_exists('storage_path')) { +if (! function_exists('storage_path')) { /** * Get the path to the storage folder. * - * @param string $path - * + * @param string $path * @return string */ function storage_path($path = '') { - return app('path.storage') . ($path ? DIRECTORY_SEPARATOR . $path : $path); + return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); } } -if ( ! function_exists('trans')) { +if (! function_exists('trans')) { /** * Translate the given message. * - * @param string $key - * @param array $replace - * @param string $locale - * + * @param string $key + * @param array $replace + * @param string $locale * @return \Illuminate\Contracts\Translation\Translator|string|array|null */ function trans($key = null, $replace = [], $locale = null) @@ -874,15 +830,14 @@ function trans($key = null, $replace = [], $locale = null) } } -if ( ! function_exists('trans_choice')) { +if (! function_exists('trans_choice')) { /** * Translates the given message based on a count. * - * @param string $key - * @param int|array|\Countable $number - * @param array $replace - * @param string $locale - * + * @param string $key + * @param int|array|\Countable $number + * @param array $replace + * @param string $locale * @return string */ function trans_choice($key, $number, array $replace = [], $locale = null) @@ -891,14 +846,13 @@ function trans_choice($key, $number, array $replace = [], $locale = null) } } -if ( ! function_exists('__')) { +if (! function_exists('__')) { /** * Translate the given message. * - * @param string $key - * @param array $replace - * @param string $locale - * + * @param string $key + * @param array $replace + * @param string $locale * @return \Illuminate\Contracts\Translation\Translator|string */ function __($key = null, $replace = [], $locale = null) @@ -907,14 +861,13 @@ function __($key = null, $replace = [], $locale = null) } } -if ( ! function_exists('url')) { +if (! function_exists('url')) { /** * Generate a url for the application. * - * @param string $path - * @param mixed $parameters - * @param bool $secure - * + * @param string $path + * @param mixed $parameters + * @param bool $secure * @return \Illuminate\Contracts\Routing\UrlGenerator|string */ function url($path = null, $parameters = [], $secure = null) @@ -927,15 +880,14 @@ function url($path = null, $parameters = [], $secure = null) } } -if ( ! function_exists('validator')) { +if (! function_exists('validator')) { /** * Create a new Validator instance. * - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes - * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes * @return \Illuminate\Contracts\Validation\Validator */ function validator(array $data = [], array $rules = [], array $messages = [], array $customAttributes = []) @@ -950,14 +902,13 @@ function validator(array $data = [], array $rules = [], array $messages = [], ar } } -if ( ! function_exists('view')) { +if (! function_exists('view')) { /** * Get the evaluated view contents for the given view. * - * @param string $view - * @param array $data - * @param array $mergeData - * + * @param string $view + * @param array $data + * @param array $mergeData * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory */ function view($view = null, $data = [], $mergeData = []) From 13e1735908f48d240eab11244e51a30eab3a1f59 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:04:28 -0600 Subject: [PATCH 06/11] . --- src/Illuminate/Foundation/helpers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 803a3206ba26..7faa3c8308f7 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -571,7 +571,8 @@ function mix($path, $manifestDirectory = '') if (! isset($manifest[$path])) { - $mixMessage = "Unable to locate Mix file: {$path}. Please check your " . 'webpack.mix.js output paths and try again.'; + $mixMessage = "Unable to locate Mix file: {$path}. Please check your ". + 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); From c8ba799f71ac251d7877073c096af03fa2522bcf Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:07:51 -0600 Subject: [PATCH 07/11] . --- src/Illuminate/Foundation/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 7faa3c8308f7..39bf28fd62b7 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -572,7 +572,7 @@ function mix($path, $manifestDirectory = '') if (! isset($manifest[$path])) { $mixMessage = "Unable to locate Mix file: {$path}. Please check your ". - 'webpack.mix.js output paths and try again.'; + "webpack.mix.js output paths and try again."; report(new Exception($mixMessage)); From 3e844c7a8bbbbb2714cb09d959aca5b3e4e48667 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:09:20 -0600 Subject: [PATCH 08/11] . --- src/Illuminate/Foundation/helpers.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 39bf28fd62b7..d57d78a0b9a4 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -571,8 +571,7 @@ function mix($path, $manifestDirectory = '') if (! isset($manifest[$path])) { - $mixMessage = "Unable to locate Mix file: {$path}. Please check your ". - "webpack.mix.js output paths and try again."; + $mixMessage = "Unable to locate Mix file: {$path}. Please check your webpack.mix.js output paths and try again."; report(new Exception($mixMessage)); From 490c7e207d0d98188bb0747f333652b3547227e3 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Wed, 16 Aug 2017 22:11:33 -0600 Subject: [PATCH 09/11] =?UTF-8?q?CI=20doesn=E2=80=99t=20like=20the=20messa?= =?UTF-8?q?ge.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Illuminate/Foundation/helpers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index d57d78a0b9a4..4e3e5600b801 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -571,7 +571,8 @@ function mix($path, $manifestDirectory = '') if (! isset($manifest[$path])) { - $mixMessage = "Unable to locate Mix file: {$path}. Please check your webpack.mix.js output paths and try again."; + $mixMessage = "Unable to locate Mix file: {$path}. Please check your ". + 'webpack.mix.js output paths and try again.'; report(new Exception($mixMessage)); From d3e5ab623dbb4509ac689bd7e9b5fb9a8b9eea8b Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Thu, 17 Aug 2017 07:42:24 -0600 Subject: [PATCH 10/11] removed logging from mix() --- src/Illuminate/Foundation/helpers.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 4e3e5600b801..7ab7c8b6d99e 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -570,17 +570,8 @@ function mix($path, $manifestDirectory = '') $manifest = $manifests[$manifestPath]; if (! isset($manifest[$path])) { - - $mixMessage = "Unable to locate Mix file: {$path}. Please check your ". - 'webpack.mix.js output paths and try again.'; - - report(new Exception($mixMessage)); - - if (! app('config')->get('app.debug')) { - app('log')->info($mixMessage); - - return $path; - } + report(new Exception("Unable to locate Mix file: {$path}. Please check your ". + 'webpack.mix.js output paths and try again.')); } return new HtmlString($manifestDirectory.$manifest[$path]); From 0d450fb150894ff5728e877f5d46d88c605d2186 Mon Sep 17 00:00:00 2001 From: Adam Patterson Date: Thu, 17 Aug 2017 14:44:06 -0600 Subject: [PATCH 11/11] will return the mix path if debug is false. --- src/Illuminate/Foundation/helpers.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 7ab7c8b6d99e..84f0ee6d219c 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -572,6 +572,10 @@ function mix($path, $manifestDirectory = '') if (! isset($manifest[$path])) { report(new Exception("Unable to locate Mix file: {$path}. Please check your ". 'webpack.mix.js output paths and try again.')); + + if (! app('config')->get('app.debug')) { + return $path; + } } return new HtmlString($manifestDirectory.$manifest[$path]);