lundi 6 mai 2019

How to create a Custom Console Command to migrate all migration files

I`m creating a console command to auto-install my project. This console command needs to run the composer install, update, etc. All those things are covered, but Artisan::call('migrate') to deploy the DB structure is not working. Further than this, is not doing nothing. No action, no error message...

Here is the Console Command PHP file:


<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Artisan;

class install extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'goliatt:install';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Install Goliat Core Framework';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {

        // THIS WORKS
        exec('composer install');

        // THIS DOES NOT WORK
        $exitCode = Artisan::call('migrate');
    }
}




via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire