0

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?

11
  • Did you follow the official upgrade guide? laravel.com/docs/5.5/upgrade#upgrade-5.5.0 Commented Mar 3, 2019 at 22:12
  • Yes sir. and also a tuturial on youtube and still i have miss this :$ Commented Mar 3, 2019 at 22:16
  • did you run composer update? Commented Mar 3, 2019 at 22:47
  • yes i had and now i have try to clean the cache for exemple and gives error in cache line 91 class str not found Commented Mar 3, 2019 at 22:56
  • 1
    try to change str::slug with str_slug please Commented Mar 3, 2019 at 23:17

2 Answers 2

3

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
Sign up to request clarification or add additional context in comments.

Comments

1

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.