Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iAmKevinMcKee committed Feb 13, 2021
1 parent 1561b08 commit f279010
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public function up()
Schema::create('post_tag', function (Blueprint $table) {
$table->unsignedBigInteger('post_id');
$table->unsignedBigInteger('tag_id');
$table->foreign('post_id')->references('id')->on('users')
$table->foreign('post_id')->references('id')->on('posts')
->onDelete('cascade');
$table->foreign('tag_id')->references('id')->on('roles')
$table->foreign('tag_id')->references('id')->on('tags')
->onDelete('cascade');
});
}
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function handle()
$newMigration = str_replace('|LOWERFIRST|', Str::snake($first), $newMigration);
$newMigration = str_replace('|UPPERSECOND|', $second, $newMigration);
$newMigration = str_replace('|LOWERSECOND|', Str::snake($second), $newMigration);
$newMigration = str_replace('|LOWERPLURALFIRST|', Str::snake(Str::plural($first)), $newMigration);
$newMigration = str_replace('|LOWERPLURALSECOND|', Str::snake(Str::plural($second)), $newMigration);


$this->files->put(
base_path('database/migrations/' . now()->format('Y_m_d_His') . '_create_many_to_many_pivot_for_'
Expand Down
4 changes: 2 additions & 2 deletions src/Stubs/migration.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class CreateManyToManyPivotFor|UPPERFIRST||UPPERSECOND| extends Migration
Schema::create('|LOWERFIRST|_|LOWERSECOND|', function (Blueprint $table) {
$table->unsignedBigInteger('|LOWERFIRST|_id');
$table->unsignedBigInteger('|LOWERSECOND|_id');
$table->foreign('|LOWERFIRST|_id')->references('id')->on('users')
$table->foreign('|LOWERFIRST|_id')->references('id')->on('|LOWERPLURALFIRST|')
->onDelete('cascade');
$table->foreign('|LOWERSECOND|_id')->references('id')->on('roles')
$table->foreign('|LOWERSECOND|_id')->references('id')->on('|LOWERPLURALSECOND|')
->onDelete('cascade');
});
}
Expand Down

0 comments on commit f279010

Please sign in to comment.