Lumen-framework: use str_random() in model

Created on 18 Oct 2019  路  7Comments  路  Source: laravel/lumen-framework

  • Lumen Version: 6.x
  • PHP Version: 7.3.9

Description:

when i use str_random() in some Model, i have error like this:

Call to undefined function App\str_random()

Most helpful comment

use Illuminate\Support\Str;

$var = Str::random(32);

All 7 comments

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

I know.
but i think str_random() is php function. and it should not know as App\str_random() and when i migrate from 5.8 to 6.x i have this error!

but i think str_random() is php function.

Are you sure? https://github.com/laravel/helpers/blob/master/src/helpers.php#L482-L485

Yes it is php function.but when i use in laravel model : laravel think its models function!

use Illuminate\Support\Str;

$var = Str::random(32);

Thanks @jimoheokoh

Was this page helpful?
0 / 5 - 0 ratings

Related issues

concept47 picture concept47  路  3Comments

patrikengborg picture patrikengborg  路  3Comments

gfazioli picture gfazioli  路  5Comments

GGNB picture GGNB  路  5Comments

cvinothkumar picture cvinothkumar  路  3Comments