Laravel 6 Call to undefined function str_slug() – Solved
In this post we will give you information about Laravel 6 Call to undefined function str_slug() – Solved. Hear we will give you detail about Laravel 6 Call to undefined function str_slug() – SolvedAnd how to use it also give you demo for it if it is necessary.
Few days ago my blog viewer send me one error Call to undefined function str_slug() in laravel 6 and he told me to all string and array function like str_limit, str_uuid, array_sort, array_only, array_except etc and call as laravel 6 Call to undefined function.
So basically, you can not use string and array helpers in laravel 6. laravel 6 removed helpers function from repo. You can use
IlluminateSupportStr and IlluminateSupportArr classes for helpers. so you can use all helpers function like as bellow:
Now you can use like as bellow example:
Solution 1:
Route::get('/', function () {
$newSlug = Str::slug('I am from ItSolutionStuff.com');
dd($newSlug);
});
Solution 2:
but you want to use helpers functions then you need to install new composer package with following command:
composer require laravel/helpers
Now you can use helper function like as bellow:
Route::get('/', function () {
$newSlug = str_slug('I am from ItSolutionStuff.com');
dd($newSlug);
});
You can use Helpers like this way:
Arr::add
Arr::collapse
Arr::divide
Arr::dot
Arr::except
Arr::first
Arr::flatten
Arr::forget
Arr::get
Arr::has
Arr::last
Arr::only
Arr::pluck
Arr::prepend
Arr::pull
Arr::random
Arr::set
Arr::sort
Arr::sortRecursive
Arr::where
Arr::wrap
Str::after
Str::before
Str::camel
Str::contains
Str::containsAll
Str::endsWith
Str::finish
Str::is
Str::kebab
Str::limit
Str::orderedUuid
Str::plural
Str::random
Str::replaceArray
Str::replaceFirst
Str::replaceLast
Str::singular
Str::slug
Str::snake
Str::start
Str::startsWith
Str::studly
Str::title
Str::uuid
Str::words
I hope it can help you…
Hope this code and post will helped you for implement Laravel 6 Call to undefined function str_slug() – Solved. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs