Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bart's avatar
Level 13

[L5] Artisan::call issue

The improvements in L5 are really amazing so I'm playing around with them for a new project. I'm developing a setup command and want to call

Artisan::call('migrate', ['--seed' => true]);

which results in

UndefinedMethodException in Artisan.php line 43:
Attempted to call method "make" on class "Illuminate\Console\Application".

Do you have any idea how to solve it? Couldn't find anything in the pull requests. In my opinion I have the latest version of laravel/laravel and laravel/framework.

0 likes
7 replies
slovenianGooner's avatar

Yup, the make method is gone in that class. It's now in the constructor method. If you are into a quick fix until this is solved, you can always use exec(). Not as safe, but will do for a temporary fix on a dev project.

bart's avatar
Level 13

Thanks a lot for your response. Maybe it will be fixed today. Otherwise I will try to fix it and send a pull request! Thought it was just an issue on my maschine caused by inconsistent package versions or sth like that.

slovenianGooner's avatar

Actually you could fix it with substituting the make method with a "new ConsoleApplication($this->app, $eventDispatcher).

Have struggled to find a reference to the Event dispatcher there to include. If you find it, do send a pull request.

bart's avatar
Level 13

I tried to playing around with that but didn't found a solution. Don't really understand the new way of getting the Artisan instance.

$this->artisan = ConsoleApplication::make($this->app);

How do I have to replace it?!

bart's avatar
Level 13

I also had a discussion about it on github:

https://github.com/laravel/framework/pull/6178

I added all changes commited by crynobone but Artisan::call('migrate', ['--seed' => true]); result in the following exception:

ContextErrorException in QuestionHelper.php line 112:
Notice: Use of undefined constant STDIN - assumed 'STDIN'

Do you have any idea? Maybe a result from latest laravel kernel changes?

Btw: When adding define('STDIN',fopen("php://stdin","r")); before I'm getting:

RuntimeException in QuestionHelper.php line 146:
Aborted

This is really anoying.

bart's avatar
bart
OP
Best Answer
Level 13

I think at the current state of L5 the most simple way is using Symfonys Process class like this:

$process = new Process('cd ' . base_path() . ' && php artisan migrate --seed');
$process->run();

Maybe a good solution for anybody else.

Please or to participate in this conversation.