Paulund

Upgrading Laravel 6 - Using Arr And Str In Blade Files

With the upgrade to Laravel 6 the helper functions have been deprecated and replaced with using the Arr and Str facades directly helpers.

You will no longer be able to use the function str_slug and it will need to be replaced with Str::slug.

If you haven't done so already you will need to add the Arr and Str classes to your alias file or you won't be able to use these within your blade templates. If you don't you will see the error message like

Class 'Str' not found

To fix this open your app config file config/app.php at the bottom of the file you will see a section for aliases you will need to add both Arr and Str to the list.

'Arr' => Illuminate\Support\Arr::class,
'Str' => Illuminate\Support\Str::class,