diff options
author | Michael Weimann <mail@michael-weimann.eu> | 2019-12-03 20:09:22 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2019-12-07 21:29:11 +0100 |
commit | 24578c5cb0f75ae6ad0f52577f9fcb617ae87624 (patch) | |
tree | 4bf2874933bbd61aedb7324598d22b08e1a5c32f /db/migrations/Reference.php | |
parent | fd90679a7dd95dde94ff30f71d7dc76baa9b1253 (diff) |
Add questions table migration
Diffstat (limited to 'db/migrations/Reference.php')
-rw-r--r-- | db/migrations/Reference.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/db/migrations/Reference.php b/db/migrations/Reference.php index 719bee76..90211bc1 100644 --- a/db/migrations/Reference.php +++ b/db/migrations/Reference.php @@ -3,6 +3,7 @@ namespace Engelsystem\Migrations; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\ColumnDefinition; trait Reference { @@ -20,10 +21,11 @@ trait Reference * @param string $targetTable * @param string $fromColumn * @param bool $setPrimary + * @return ColumnDefinition */ - protected function references(Blueprint $table, $targetTable, $fromColumn, $setPrimary = false) + protected function references(Blueprint $table, $targetTable, $fromColumn, $setPrimary = false): ColumnDefinition { - $table->unsignedInteger($fromColumn); + $col = $table->unsignedInteger($fromColumn); if ($setPrimary) { $table->primary($fromColumn); @@ -33,5 +35,7 @@ trait Reference ->references('id')->on($targetTable) ->onUpdate('cascade') ->onDelete('cascade'); + + return $col; } } |