megacommit
This commit is contained in:
parent
2451ab45cb
commit
34ed81516b
51 changed files with 1200 additions and 251 deletions
|
@ -19,7 +19,7 @@ return new class extends Migration
|
|||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->enum('role', ['default', 'employee', 'manage'])->default('default');
|
||||
$table->enum('role', ['default', 'employee', 'manage', 'admin'])->default('default');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -19,8 +19,8 @@ return new class extends Migration
|
|||
$table->foreignId('permission_id')->constrained('permissions', 'permission_id');
|
||||
$table->foreignId('user_id')->constrained('users', 'user_id');
|
||||
// end can be null to mark indefinitely
|
||||
$table->date('user_permission_start')->useCurrent();
|
||||
$table->date('user_permission_end')->nullable();
|
||||
// $table->date('user_permission_start')->useCurrent();
|
||||
// $table->date('user_permission_end')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_assignments', function (Blueprint $table) {
|
||||
$table->id('user_assignment_id');
|
||||
$table->timestamps();
|
||||
$table->foreignId('cinema_id')->constrained('cinemas', 'cinema_id');
|
||||
$table->foreignId('user_id')->constrained('users', 'user_id');
|
||||
$table->unique(['cinema_id', 'user_id']); // only one user per cinema
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_assignments');
|
||||
}
|
||||
};
|
|
@ -23,17 +23,14 @@ class RoomSeeder extends Seeder
|
|||
],
|
||||
[
|
||||
'room_name' => 'Room 2',
|
||||
'room_rows' => 10,
|
||||
'room_columns' => 10,
|
||||
'room_rows' => 5,
|
||||
'room_columns' => 5,
|
||||
],
|
||||
[
|
||||
'room_name' => 'Room 3',
|
||||
'room_rows' => 10,
|
||||
'room_columns' => 10,
|
||||
],
|
||||
];
|
||||
];
|
||||
|
||||
foreach ($rooms as $room) {
|
||||
$this->command->info("Creating room {$room['room_name']} for cinema {$cinema->cinema_name}");
|
||||
|
||||
$r = new \App\Models\Room();
|
||||
$r->room_name = $room['room_name'];
|
||||
$r->room_rows = $room['room_rows'];
|
||||
|
@ -43,6 +40,7 @@ class RoomSeeder extends Seeder
|
|||
$r->save();
|
||||
|
||||
for ($row = 1; $row <= $r->room_rows; $row++) {
|
||||
$this->command->info("Creating row {$row} for room {$r->room_name}");
|
||||
for ($column = 1; $column <= $r->room_columns; $column++) {
|
||||
$s = new \App\Models\Seat();
|
||||
$s->seat_row = $row;
|
||||
|
|
|
@ -27,22 +27,60 @@ class ShowingSeeder extends Seeder
|
|||
'showing_end' => $showStart->add(new \DateInterval('PT2H'))->format('Y-m-d H:i:s'),
|
||||
'movie_id' => 1,
|
||||
'room_id' => $room->room_id,
|
||||
'pricings' => [
|
||||
[
|
||||
'price' => 10,
|
||||
'price_type' => 'adult',
|
||||
],
|
||||
[
|
||||
'price' => 8,
|
||||
'price_type' => 'senior',
|
||||
],
|
||||
[
|
||||
'price' => 2.5,
|
||||
'price_type' => 'child',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'showing_start' => $showStart->add(new \DateInterval('PT2H'))->format('Y-m-d H:i:s'),
|
||||
'showing_end' => $showStart->add(new \DateInterval('PT2H'))->format('Y-m-d H:i:s'),
|
||||
'movie_id' => 2,
|
||||
'room_id' => $room->room_id,
|
||||
],
|
||||
'pricings' => [
|
||||
[
|
||||
'price' => 10,
|
||||
'price_type' => 'adult',
|
||||
],
|
||||
[
|
||||
'price' => 8,
|
||||
'price_type' => 'senior',
|
||||
],
|
||||
[
|
||||
'price' => 3.5,
|
||||
'price_type' => 'child',
|
||||
],
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($showings as $showing) {
|
||||
$this->command->info("Creating showing for movie {$showing['movie_id']} in room {$room->room_name}");
|
||||
$s = new \App\Models\Showing();
|
||||
$s->showing_start = $showing['showing_start'];
|
||||
$s->movie_id = $showing['movie_id'];
|
||||
$s->room_id = $showing['room_id'];
|
||||
$s->user_id = 1;
|
||||
$s->save();
|
||||
|
||||
foreach ($showing['pricings'] as $pricing) {
|
||||
$p = new \App\Models\Price();
|
||||
$p->price = $pricing['price'];
|
||||
$p->price_type = $pricing['price_type'];
|
||||
$p->showing_id = $s->showing_id;
|
||||
$p->user_id = 1;
|
||||
$p->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue