Sometimes, we require to generate random string for token or something other login in laravel 5 application. if i remember exactly, 1 year ago i was working on my laravel 5 application at that moment i need to create unique string.
I search on google and laravel docs i found str_random() helper of php laravel framework to generate random string, we need to just give then number as argument and it returns automatic random string. So you can also simply use bellow function, i added syntax and example bellow:
$randomString = str_random(25);
I hope you found your best....
Do you like below Tutorials ?
- How to create PDF file in Laravel 5.6?
- PHP Laravel 5.6 get current user details
- How to get last query log in Laravel 5.6?
- PHP - How to remove double quotes from json array keys?
- Laravel 5.6 - Excel and csv import export using maatwebsite example
- VueJS - How to set maxlength for textarea?
- Laravel - Get last inserted id using save(), create() and insertGetId()
- Laravel - How to handle "No query results for model" Error