Using Artisan call to pass non-option arguments

0 votes

In the shell I can create a database migration (for example) like so:

./artisan migrate:make --table="mytable" mymigration

Using Artisan::call() I can't work out how to pass a non-argument parameter ("mymigration" in this example). I have tried many variants of the code below:

Artisan::call('db:migrate', ['--table' => 'mytable', 'mymigration'])

Anyone got any ideas? I have been using shell_exec('./artisan ...') in the meantime but I'm not happy with the approach.

Sep 28, 2020 in Laravel by kartik
• 37,520 points
1,909 views

1 answer to this question.

0 votes

Hello @kartik,

Use:

Artisan::call('db:migrate', ['' => 'mymigration', '--table' => 'mytable']) 

should work.

Incidentally db:migrate isn't an artisan command out of the box. 

Hope it helps!!
Thank you!!

answered Sep 28, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

How to make a new page with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
13,102 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,090 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
5,211 views
0 votes
1 answer

How to pass data with routing ?

First you can follow how to pass ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
1,380 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,392 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
3,342 views
0 votes
1 answer

How to enable Bootstrap tooltip on disabled button?

Hii @kartik, You can wrap the disabled button ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
5,144 views
+1 vote
2 answers

How to set cache false for getJSON in jQuery?

You can't pass any configuration parameters to ...READ MORE

answered Oct 7, 2020 in JQuery by Amit
• 140 points
2,982 views
0 votes
2 answers

How to pass variable to next page using php?

Simply use Sessions my friend Page1: session_start(); $ ...READ MORE

answered Oct 6, 2020 in Laravel by anonymous
• 140 points
14,974 views
0 votes
1 answer

How to get response from Artisan call?

Hello @kartik,  You can simply use: Artisan::output() READ MORE

answered Dec 2, 2020 in Laravel by Niroj
• 82,840 points
2,366 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP