Skip to content

Commit

Permalink
Check that method exists before calling it in migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 23, 2017
1 parent 7e4a5a5 commit d27d94e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Illuminate/Database/Migrations/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ protected function runMigration($migration, $method)
);

$callback = function () use ($migration, $method) {
$migration->{$method}();
if (method_exists($migration, $method)) {
$migration->{$method}();
}
};

$this->getSchemaGrammar($connection)->supportsSchemaTransactions()
Expand Down Expand Up @@ -390,7 +392,9 @@ protected function getQueries($migration, $method)
);

return $db->pretend(function () use ($migration, $method) {
$migration->$method();
if (method_exists($migration, $method)) {
$migration->{$method}();
}
});
}

Expand Down

0 comments on commit d27d94e

Please sign in to comment.