Laravel Return Migration and Eloquent Response

Is there any way to get the response or message from the migration and eloquent? Regardless of success or failure.

Migration:

$response = Artisan::call('make:model', [
    'name' => 'MyModel'
    '-m' => true
]);
//I need the response for my next step

Eloquent:

$response = MyModel::create($myValues);
//I need the response for my next step

1 answer

  • answered 2021-02-24 10:48 mohammad asghari

    Use like this:

    $myModel = new myModel();
    $myModel->value = 'value';
    $myModel->save(); // you can use create or other function here
    

    Now your result is in $myModel. It's not related to migration.