Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

resource controller

Hello,

What does this syntax means:

php artisan make:controller PhotoController --resource

I check it here: https://laravel.com/docs/5.5/controllers

C:\xampp\htdocs\soulfy_repo\framework>php artisan make:controller Test2Controller --resource

[RuntimeException] The "--resource" option does not exist.

without resource is working, is it the same thing?

Is resource means using route::resource ?

0 likes
5 replies
RamjithAp's avatar

When you use resource controller command laravel automatically create basic function like store, update, delete functions in your controller. Also when you writing routes for those functions become easy. For example, you can write Route::resource('post',PostController) in your route file and if you make GET request it uses controller index function similarly post method execute store function, patch method execute update function and delete method execute delete function. Mostly these resource controllers are useful when you creating API for your application.

davy_yg's avatar
Level 27

Is it the same thing like writing:

php artisan make:controller Test2Controller

// without --resource

Since I cannot write --resource and works.

C:\xampp\htdocs\soulfy_repo\framework>php artisan make:controller Test2Controller --resource

[RuntimeException] The "--resource" option does not exist.

I think my laravel version is still 5.1 since the program that I add features is old. It will takes sometimes if I want to upgrade. At least wait until I am good with laravel if not I might create big problem that I do not know how to fix later if I upgrade it. 5.1 --> 5.5 is a BIG difference RIGHT?

RamjithAp's avatar

Yes that's right upgrade it. And upgrading version is not a big deal at all just go to their documentation website and see what are the functions they depreciated and replaced. Just change those functions and upgrade. And additionally, if you are using any libraries which don't support latest version upgrade it too.

davy_yg's avatar
Level 27

I don't think I am ready for upgrade since there are more than 1 developer that help adding feature. Me and the other one out source and it cost the owner money.

I also only can spot one difference regarding the version. Like the route is still using Route::controller which only exist in version 5.1

I also do not know what to replace that with. I also cannot list all the difference between the two version and what are all the things that I need changes.

Please or to participate in this conversation.