5

I've upgraded to Laravel 5.8

One of the changes as per the docs in 5.8 is that All array_* and str_* global helpers have been deprecated (https://laravel.com/docs/5.8/upgrade#string-and-array-helpers)

In my blade view I have the following:

 {{ (Arr::has($queryString, 'industry') ? Arr::get($queryString, 'industry')  : '')  }}

This is throwing error:

Class 'Arr' not found...

If I include the full name space then it works:

{{ (Illuminate\Support\Arr::has($queryString, 'industry') ? Illuminate\Support\Arr::get($queryString, 'industry') : '') }}

Please advise.

adam78
  • 9,668
  • 24
  • 96
  • 207

1 Answers1

16

I figured it out.

Need to update the app config file and include the following to the aliases array:

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

Then clear the config cache in order for the new aliases to start working: php artisan cache:clear

[editor's note: an earlier typo has now been corrected]

adam78
  • 9,668
  • 24
  • 96
  • 207