【发布时间】:2021-02-24 10:16:33
【问题描述】:
有没有什么方法可以得到迁移和雄辩的响应或消息?不管成败。
迁移:
$response = Artisan::call('make:model', [
'name' => 'MyModel'
'-m' => true
]);
//I need the response for my next step
雄辩:
$response = MyModel::create($myValues);
//I need the response for my next step
【问题讨论】:
-
$response = MyModel::create($myValues);为此,您将获得创建的对象作为响应。
-
@VishalTarkar 有没有办法知道创建时是否有问题,以便我们知道何时回滚到上一个操作。
-
检查传递给output buffer的内容可能是值得的
-
当然!有。您可以在 Try Catch 中添加此特定代码。 & 也使用 DB 事务回滚。
标签: laravel laravel-5 eloquent migration