It's a perfectly fine way to do it. Is there anything you don't like about this approach?
Jul 3, 2019
6
Level 12
Creating models with controllers, factories and migrations
I've been following the courses to learn Laravel and I've learnt that to create a controller with a model I do:
php artisan make:controller Posts -r -m Post
but if I want to do a migration with a factory then I need to add that to a model so I shouldn't add -m above but do:
php artisan make:model Post -m -f
I've been doing some searching and I have found that to get all 4 I should do:
php artisan make:model Post -crm
Is this right and is this the best way of doing it?
Level 73
You can run php artisan help make:model it will give you all the possible options, so in your case I believe you can achieve it by running:
php artisan make:model Post -a
1 like
Please or to participate in this conversation.