return redirect()->action('BookingController@index') laravel 8

Viewed 616

I am following a tutorial using old version of laravel , but I am using Laravel 8 this line of code is causing error :

return redirect()->action('BookingController@index');

it is in the store action in BookingController.php , This is the output of the error

Action BookingController@index not defined.

do anyone has an idea?

Thanks in advance

1 Answers

In previous releases of Laravel 8, the RouteServiceProvider class contained a $namespace property with a value of App\Http\Controllers. The value of this property was used to automatically prefix controller route declarations and controller route URL generation such as when calling the action helper :

redirect()->action('App\Http\Controllers\BookingController@index');

See Upgrade Guide to Laravel 8.x (Automatic Controller Namespace Prefixing)

Related