Laravel 5.4 create model, controller and migration in single artisan command
I can create a model and resource controller (binded to model) with the following command
php artisan make:controller TodoController --resource --model=Todo
I want to also create a migration with the above command, is it possible?
laravel laravel-5.4 artisan
add a comment |
I can create a model and resource controller (binded to model) with the following command
php artisan make:controller TodoController --resource --model=Todo
I want to also create a migration with the above command, is it possible?
laravel laravel-5.4 artisan
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21
add a comment |
I can create a model and resource controller (binded to model) with the following command
php artisan make:controller TodoController --resource --model=Todo
I want to also create a migration with the above command, is it possible?
laravel laravel-5.4 artisan
I can create a model and resource controller (binded to model) with the following command
php artisan make:controller TodoController --resource --model=Todo
I want to also create a migration with the above command, is it possible?
laravel laravel-5.4 artisan
laravel laravel-5.4 artisan
edited Jun 27 '17 at 12:47
Christophvh
4,58033247
4,58033247
asked Apr 3 '17 at 14:48
arunarun
1,6661819
1,6661819
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21
add a comment |
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21
add a comment |
9 Answers
9
active
oldest
votes
You can do it if you start from the model
php artisan make:model Todo -mcr
if you run php artisan make:model --help
you can see all the available options
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
Update
As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:
php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource
controller for the model
12
Now we can usephp artisan make:model Todo -a
to create model, migration, resource controller andfactory
– arun
Apr 11 '18 at 12:43
add a comment |
you can make model + migration + controller, all in one line, using this command
php artisan make:model --migration --controller test
Short version: php artisan make:model -mc test
Output :-
Model created successfully.
Created Migration:2018_03_10_002331_create_tests_table
Controller created successfully.
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
add a comment |
You can do it with the following command:
php artisan make:model post -mc
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
add a comment |
php artisan make:model PurchaseRequest -crm
The Result is
Model created successfully.
Created Migration: 2018_11_11_011541_create_purchase_requests_table
Controller created successfully.
Just use -crm instead of -mcr
add a comment |
To make mode, controllers with resources, You can type CMD as follows :
php artisan make:model Todo -mcr
or you can check by typing
php artisan help make:model
where you can get all the ideas
add a comment |
You can use -m -c -r to make migration, model and controller.
php artisan make:model Post -m -c -r
add a comment |
To make all 3: Model, Controller & Migration Schema of table
write in your console: php artisan make:model NameOfYourModel -mcr
add a comment |
Laravel 5.4 You can use
php artisan make:model --migration --controller --resource Test
This will create
1) Model
2) controller with default resource function
3) Migration file
And Got Answer
Model created successfully.
Created Migration: 2018_04_30_055346_create_tests_table
Controller created successfully.
add a comment |
We can use php artisan make:model Todo -a
to create model, migration, resource controller and factory
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43187735%2flaravel-5-4-create-model-controller-and-migration-in-single-artisan-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do it if you start from the model
php artisan make:model Todo -mcr
if you run php artisan make:model --help
you can see all the available options
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
Update
As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:
php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource
controller for the model
12
Now we can usephp artisan make:model Todo -a
to create model, migration, resource controller andfactory
– arun
Apr 11 '18 at 12:43
add a comment |
You can do it if you start from the model
php artisan make:model Todo -mcr
if you run php artisan make:model --help
you can see all the available options
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
Update
As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:
php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource
controller for the model
12
Now we can usephp artisan make:model Todo -a
to create model, migration, resource controller andfactory
– arun
Apr 11 '18 at 12:43
add a comment |
You can do it if you start from the model
php artisan make:model Todo -mcr
if you run php artisan make:model --help
you can see all the available options
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
Update
As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:
php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource
controller for the model
You can do it if you start from the model
php artisan make:model Todo -mcr
if you run php artisan make:model --help
you can see all the available options
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller
Update
As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:
php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource
controller for the model
edited May 24 '18 at 13:36
answered Apr 3 '17 at 14:52
ChristophvhChristophvh
4,58033247
4,58033247
12
Now we can usephp artisan make:model Todo -a
to create model, migration, resource controller andfactory
– arun
Apr 11 '18 at 12:43
add a comment |
12
Now we can usephp artisan make:model Todo -a
to create model, migration, resource controller andfactory
– arun
Apr 11 '18 at 12:43
12
12
Now we can use
php artisan make:model Todo -a
to create model, migration, resource controller and factory
– arun
Apr 11 '18 at 12:43
Now we can use
php artisan make:model Todo -a
to create model, migration, resource controller and factory
– arun
Apr 11 '18 at 12:43
add a comment |
you can make model + migration + controller, all in one line, using this command
php artisan make:model --migration --controller test
Short version: php artisan make:model -mc test
Output :-
Model created successfully.
Created Migration:2018_03_10_002331_create_tests_table
Controller created successfully.
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
add a comment |
you can make model + migration + controller, all in one line, using this command
php artisan make:model --migration --controller test
Short version: php artisan make:model -mc test
Output :-
Model created successfully.
Created Migration:2018_03_10_002331_create_tests_table
Controller created successfully.
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
add a comment |
you can make model + migration + controller, all in one line, using this command
php artisan make:model --migration --controller test
Short version: php artisan make:model -mc test
Output :-
Model created successfully.
Created Migration:2018_03_10_002331_create_tests_table
Controller created successfully.
you can make model + migration + controller, all in one line, using this command
php artisan make:model --migration --controller test
Short version: php artisan make:model -mc test
Output :-
Model created successfully.
Created Migration:2018_03_10_002331_create_tests_table
Controller created successfully.
answered Mar 9 '18 at 11:00
Udhav SarvaiyaUdhav Sarvaiya
1,81261424
1,81261424
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
add a comment |
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
1
1
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
please use php artisan make:model --migration --controller --resource Test .
– Affan
Apr 30 '18 at 5:55
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
bro i create first and then post this . actually i use your given command and add --resource at end and this work please check from you end . I am useing laravel 5.4 . may lower version of laravel not support . @Udhav
– Affan
Apr 30 '18 at 8:24
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
I installed fresh Laravel, Your suggestion code is working, thank you @Affan :)
– Udhav Sarvaiya
Apr 30 '18 at 9:14
add a comment |
You can do it with the following command:
php artisan make:model post -mc
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
add a comment |
You can do it with the following command:
php artisan make:model post -mc
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
add a comment |
You can do it with the following command:
php artisan make:model post -mc
You can do it with the following command:
php artisan make:model post -mc
edited Oct 14 '17 at 19:37
jrtapsell
3,96111237
3,96111237
answered Oct 14 '17 at 12:36
sunilsunil
5912
5912
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
add a comment |
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
just use this command
– sunil
Oct 14 '17 at 12:40
just use this command
– sunil
Oct 14 '17 at 12:40
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
Op had resource in his question so your answer is incomplete.
– Landon Call
Apr 12 '18 at 3:05
add a comment |
php artisan make:model PurchaseRequest -crm
The Result is
Model created successfully.
Created Migration: 2018_11_11_011541_create_purchase_requests_table
Controller created successfully.
Just use -crm instead of -mcr
add a comment |
php artisan make:model PurchaseRequest -crm
The Result is
Model created successfully.
Created Migration: 2018_11_11_011541_create_purchase_requests_table
Controller created successfully.
Just use -crm instead of -mcr
add a comment |
php artisan make:model PurchaseRequest -crm
The Result is
Model created successfully.
Created Migration: 2018_11_11_011541_create_purchase_requests_table
Controller created successfully.
Just use -crm instead of -mcr
php artisan make:model PurchaseRequest -crm
The Result is
Model created successfully.
Created Migration: 2018_11_11_011541_create_purchase_requests_table
Controller created successfully.
Just use -crm instead of -mcr
edited Nov 11 '18 at 1:48
Stephen Rauch
28.3k153356
28.3k153356
answered Nov 11 '18 at 1:23
G Dhe Einstein gedeeinsteinG Dhe Einstein gedeeinstein
261
261
add a comment |
add a comment |
To make mode, controllers with resources, You can type CMD as follows :
php artisan make:model Todo -mcr
or you can check by typing
php artisan help make:model
where you can get all the ideas
add a comment |
To make mode, controllers with resources, You can type CMD as follows :
php artisan make:model Todo -mcr
or you can check by typing
php artisan help make:model
where you can get all the ideas
add a comment |
To make mode, controllers with resources, You can type CMD as follows :
php artisan make:model Todo -mcr
or you can check by typing
php artisan help make:model
where you can get all the ideas
To make mode, controllers with resources, You can type CMD as follows :
php artisan make:model Todo -mcr
or you can check by typing
php artisan help make:model
where you can get all the ideas
answered May 16 '18 at 19:20
Nirmal KhadkaNirmal Khadka
211
211
add a comment |
add a comment |
You can use -m -c -r to make migration, model and controller.
php artisan make:model Post -m -c -r
add a comment |
You can use -m -c -r to make migration, model and controller.
php artisan make:model Post -m -c -r
add a comment |
You can use -m -c -r to make migration, model and controller.
php artisan make:model Post -m -c -r
You can use -m -c -r to make migration, model and controller.
php artisan make:model Post -m -c -r
edited Oct 21 '18 at 16:40
raBne
1,71112032
1,71112032
answered May 23 '18 at 18:00
Deepak singh ThakurDeepak singh Thakur
11117
11117
add a comment |
add a comment |
To make all 3: Model, Controller & Migration Schema of table
write in your console: php artisan make:model NameOfYourModel -mcr
add a comment |
To make all 3: Model, Controller & Migration Schema of table
write in your console: php artisan make:model NameOfYourModel -mcr
add a comment |
To make all 3: Model, Controller & Migration Schema of table
write in your console: php artisan make:model NameOfYourModel -mcr
To make all 3: Model, Controller & Migration Schema of table
write in your console: php artisan make:model NameOfYourModel -mcr
answered Apr 10 '18 at 5:40
clusterBuddyclusterBuddy
544314
544314
add a comment |
add a comment |
Laravel 5.4 You can use
php artisan make:model --migration --controller --resource Test
This will create
1) Model
2) controller with default resource function
3) Migration file
And Got Answer
Model created successfully.
Created Migration: 2018_04_30_055346_create_tests_table
Controller created successfully.
add a comment |
Laravel 5.4 You can use
php artisan make:model --migration --controller --resource Test
This will create
1) Model
2) controller with default resource function
3) Migration file
And Got Answer
Model created successfully.
Created Migration: 2018_04_30_055346_create_tests_table
Controller created successfully.
add a comment |
Laravel 5.4 You can use
php artisan make:model --migration --controller --resource Test
This will create
1) Model
2) controller with default resource function
3) Migration file
And Got Answer
Model created successfully.
Created Migration: 2018_04_30_055346_create_tests_table
Controller created successfully.
Laravel 5.4 You can use
php artisan make:model --migration --controller --resource Test
This will create
1) Model
2) controller with default resource function
3) Migration file
And Got Answer
Model created successfully.
Created Migration: 2018_04_30_055346_create_tests_table
Controller created successfully.
answered Apr 30 '18 at 8:28
AffanAffan
800313
800313
add a comment |
add a comment |
We can use php artisan make:model Todo -a
to create model, migration, resource controller and factory
add a comment |
We can use php artisan make:model Todo -a
to create model, migration, resource controller and factory
add a comment |
We can use php artisan make:model Todo -a
to create model, migration, resource controller and factory
We can use php artisan make:model Todo -a
to create model, migration, resource controller and factory
answered 22 hours ago
Prakash PazhanisamyPrakash Pazhanisamy
8401923
8401923
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43187735%2flaravel-5-4-create-model-controller-and-migration-in-single-artisan-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think in this case the flag --resource is not needed. --model is enough.
– Stratboy
Oct 7 '18 at 16:21