1

Well I see This stackoverflow question and that's very close to my issue, but I want something like that with this difference:

My models are inside app/Model folder

My controllers are inside app\Http\Controllers\Web folder

As much as I know, answer which is mentioned in this post's accepted answer can help me to just define first rule using

php artisan make:model Model/MyModel -mcr

that would be make controller inside app\Http\Controllers folder itself.

Is there any way that I can define the target folder for Controller in my custom folder using this single line command?

Note: I saw this question and answers too but it's not single line command.

Community
  • 1
  • 1
Kiyarash
  • 2,437
  • 7
  • 32
  • 61
  • @TruongDang please read the question again. I'm talking about `single line command` – Kiyarash May 16 '19 at 04:00
  • You have made your custom command for it. You can take a reference from here https://github.com/appzcoder/crud-generator/blob/master/src/Commands/CrudModelCommand.php – Gautam Patadiya May 16 '19 at 04:13

1 Answers1

1

I know you can do it through the controller command as the --model flag accepts value, so this would work, but you cannot create a migration through the controller command.

php artisan make:controller Web/YourController -r --model=Model/YourModel

and this won't work

php artisan make:model Model/YourModel --controller=Web/YourController -rm                    

But you can write your own command for this.

nakov
  • 13,938
  • 12
  • 60
  • 110