Darkur

ErrorException: Array to string conversion

laravel Icon

ErrorException

Array to string conversion

An unhandled exception occurred on line 410
407
    {
408
        $name = $this->getResourceRouteName($resource, $method, $options);
409
410
        $action = ['as' => $name, 'uses' => $controller.'@'.$method];
411
412
        if (isset($options['middleware'])) {

Solution

In a 'resource controller' you don't use '[ ]'
so use:
Route::resource('/route', ExampleController::class);

instead of ->
Route::resource('/route', [ExampleController::class]);            
May 03, 2021 Anyone

0 replies


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your Laravel errors.

Chrome logo Add to Chrome - It's free