Error : Call to Undefined Function str_slug in Laravel 8 (Solved)

Hello artisan in this error fixing tutorial i am going to solve an Laravel error which is call to undefined function str slug in laravel 8. In this example i will solve call to undefined function str_slug() error. If you want to use this helper method in laravel then you have to install laravel composer helper package. Run below command to solve this issue.

Run this command to solve call to undefined function str_slug()

composer require laravel/helpers

 

Or you can use facades class to avoid this helper calling or installing this command. It is pretty good to use. No need to install package. Just use Str::slug() to fix this error. See the below example:

use Illuminate\Support\Str;

public function index(Request $request)
{
   $slug = Str::slug($request->title);
}

 

Hope it can help you.

 

Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.