Skip to content
Advertisement

Laravel 8: Array to string conversion while calling route:list

I have a resource controller which is ArticleController and I want to call this controller in web.php, so I coded:

JavaScript

Then I tried the command php artisan route:list to check the routes but I get this error message:

ErrorException

Array to string conversion

So why this error occurs, how can I fix it?

Advertisement

Answer

Route::resource is expecting a string for the second argument, not an array.

JavaScript

Remove the call to namespace for the group, you don’t need any namespace prefix because you are using the Fully Qualified Class Name, FQCN, to reference the Controllers.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement