質問

Sorry if I am asking a silly question here, but I have googled it a lot and couldn't find any satisfactory answer.

I have some experience with codeigniter and I am new to laravel.

I have just installed laravel and jeffrey way generator tool. I am first working on my back-end admin panel, so what I need is to create nested resources so it will map to domain.com/admin/SomeController

But while using php artisan generate:resource country --fields="name:string, status:boolean"

It is working fine. but generating controllers, models, views etc in respective root directory and controller name should also be changed to support nested controllers

I want to create all these in some meaningful directory structure

  • App/controllers/admin/AdminCountryController.php
  • App/models/admin/Country.php
  • App/views/admin/country/index.blade.php etc.

I also checked generator tool documentation but couldn't find these details.

So I want to know how can it be achieved using generator or I have to do it manually.

If I chosen wrong path please tell me as I am at very initial phase of my project and my application structure will depend on it.

役に立ちましたか?

解決

You need to create first that directory. For example, you want a controller app/controller/admin/AdminController.php, first create the admin folder on app/controller, then you can do php artisan generate:controller admin/adminController.php. I am not sure if this coulde be done using Resouce.

Also routing in laravel is different with routing in CI. CI depends on domain.com/controllerClass/method/args and laravel is different.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top