mardi 22 novembre 2016

Trigger Laravel Console Command to Run Only Once

I have an artisan command that I created and that need to be executed by my team.

php artisan language:seed


I usually place my cron tasks in my cron tab file. BUT Since this one is a one time task, I'm not sure where I should configure my command.


I was thinking about using Laravel migration.

Should I add that command as part of my migration script ?

public function up()
{
    $language = Language::where('id','=','1')->first();
    if($language == null){
        $url = shell_exec('php artisan language:seed');
    }
}


Question

I did look into this and this , but I didn't really see what I am looking for.

Should I still add it as part of my cron task, but make sure it only run one time ?

How would one go about and implement this ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire