After upgrading Laravel from 5.6 to 6.0, Call to undefined str_random() function not working

后端 未结 4 1066
说谎
说谎 2020-12-15 06:29

I have upgraded Laravel from 5.6 to 6.0. Previously, default helper functions were running fine on the controllers, but now it says \"undefined.\" In my con

4条回答
  •  孤街浪徒
    2020-12-15 07:10

    Add the following string library.

    use Illuminate\Support\Str;
    

    now you can use it as below.

    $filename = Str::random(40)
    

    alternatively, install the following package.

    composer require laravel/helpers
    

提交回复
热议问题