I have tried to update my Laravel from 5.4 to 5.5 but I am having some errors-
Uncaught Error: Call to undefined method Whoops\\Handler\\PrettyPageHandler::setApplicationPaths() in...
Laravel log shows something like this-
production.ERROR: Class 'str' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'str' not found at C:\\xampp\\htdocs\\teste\\config\\cache.php:91) [stacktrace]
production.ERROR: Class 'str' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'str' not found at C:\\xampp\\htdocs\\teste\\config\\cache.php:91) [stacktrace]
This is how my cache.php looks-
'prefix' => env(
'CACHE_PREFIX',
str::slug(env('APP_NAME', 'laravel'), '_').'_cache'
),
The line 91 is the str::slug. Any idea what am I missing?
You need to change your string function call like one of these-
str_slug('your_string');
Or this
use Str;
Str::slug('your_string');
Make sure to run this once you make changes in your config files so your config changes can be cached again and work as intended-
php artisan config:cache
To use Str
in blade templates you can add to app.php
class_alias('Illuminate\Support\Str', 'Str');
or for newer versions to alias section in config/app.php
'Str' => Illuminate\Support\Str::class,
and {{ Str::slug('your_string') }}
becomes available/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.