ホーム > Laravel > I got an error when I created a directory called List in Laravel
Laravel

I got an error when I created a directory called List in Laravel

Thank you for your continued support.
This article contains advertisements that help fund our operations.

⇨ Click here for the table of contents of Laravel articles

The main error message this time is here:

syntax error, unexpected 'List' (T_LIST), expecting identifier (T_STRING)

Conclusion

As the title suggests, the cause was creating a controller in a directory named List.

Since it is already used elsewhere, let's avoid using List.

The sequence of events that led to the error is as follows:

php artisan make:controller List/SearchController

I created a directory called List and a controller like this.

Then this error occurred.

Countermeasure

Let's change it to Lists! or something (lol)

php artisan make:controller Lists/SearchController

Summary

That's it.

For feedback or complaints, please contact me via Twitter DM.

See you!

Popular Articles

Deploying PHP7.4 + Laravel6 project to AWS EC2

Implementing breadcrumbs in Laravel with laravel-breadcrumbs

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!