Test dynamic relationships (#1017)

* Test dynamic

* Try/catch relationships

* Update snapshot

* Test output
This commit is contained in:
Barry vd. Heuvel
2020-08-25 08:01:16 +02:00
committed by GitHub
parent ac6fbffac3
commit c852650d7e
7 changed files with 161 additions and 3 deletions
+5 -1
View File
@@ -570,7 +570,11 @@ class ModelsCommand extends Command
// can cause errors. Since we don't need constraints we can
// disable them when we fetch the relation to avoid errors.
$relationObj = Relation::noConstraints(function () use ($model, $method) {
return $model->$method();
try {
return $model->$method();
} catch (\Throwable $e) {
return null;
}
});
if ($relationObj instanceof Relation) {