Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Command and Cron #75

Closed
icemanblas opened this issue Sep 8, 2015 · 2 comments
Closed

Laravel Command and Cron #75

icemanblas opened this issue Sep 8, 2015 · 2 comments
Labels

Comments

@icemanblas
Copy link

Hi,
I have Laravel command and I want to execute it with cron job. Here's the code:

<?php namespace App\Console\Commands;

// ...

class TestCommand extends Command {
    protected $name = 'test';
    // ...
    public function fire() {
        // code goes here
    }
    ...
}

I want to be able to execute this command with cron job. How do I do this? Thanks in advance.

@liebig liebig added the question label Sep 9, 2015
@liebig
Copy link
Owner

liebig commented Sep 9, 2015

Hi,
Please try to call the Artisan command via code. For example:

$exitCode = Artisan::call('email:send', [
    'user' => 1, '--queue' => 'default'
]);

You can find more details at the Laravel documentation.

@icemanblas
Copy link
Author

Thanks a lot, I must have missed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants