Skip to content

Commit d27d94e

Browse files
committed
Check that method exists before calling it in migration.
1 parent 7e4a5a5 commit d27d94e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Illuminate/Database/Migrations/Migrator.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ protected function runMigration($migration, $method)
349349
);
350350

351351
$callback = function () use ($migration, $method) {
352-
$migration->{$method}();
352+
if (method_exists($migration, $method)) {
353+
$migration->{$method}();
354+
}
353355
};
354356

355357
$this->getSchemaGrammar($connection)->supportsSchemaTransactions()
@@ -390,7 +392,9 @@ protected function getQueries($migration, $method)
390392
);
391393

392394
return $db->pretend(function () use ($migration, $method) {
393-
$migration->$method();
395+
if (method_exists($migration, $method)) {
396+
$migration->{$method}();
397+
}
394398
});
395399
}
396400

0 commit comments

Comments
 (0)