diff --git a/skolehjem/app/Http/Controllers/WashingReservationController.php b/skolehjem/app/Http/Controllers/WashingReservationController.php index 050a38a..a38660c 100644 --- a/skolehjem/app/Http/Controllers/WashingReservationController.php +++ b/skolehjem/app/Http/Controllers/WashingReservationController.php @@ -164,7 +164,10 @@ class WashingReservationController extends Controller $machines = WashingMachine::all(); - $reservations = WashingReservation::query()->where("time", "LIKE", substr($date, 1, strpos($date, "T"))."%")->get(); + if($request->machine_id == 0) + $request->machine_id = WashingMachine::all()->first()->id; + + $reservations = WashingReservation::query()->where("machine_id", "=", $request->machine_id)->where("time", "LIKE", substr($date, 1, strpos($date, "T"))."%")->get(); $times = []; diff --git a/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php b/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php index 2ddad31..1d3d3b8 100644 --- a/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php +++ b/skolehjem/database/migrations/2020_06_08_080402_create_permission_tables.php @@ -37,6 +37,7 @@ class CreatePermissionTables extends Migration Schema::create($tableNames['roles'], function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); + $table->unique('name'); $table->string('description'); $table->string('guard_name'); $table->timestamps(); diff --git a/skolehjem/database/migrations/2020_06_09_081126_alter_washing_reservations.php b/skolehjem/database/migrations/2020_06_09_081126_alter_washing_reservations.php deleted file mode 100644 index d39a3bb..0000000 --- a/skolehjem/database/migrations/2020_06_09_081126_alter_washing_reservations.php +++ /dev/null @@ -1,29 +0,0 @@ -string('tuesday', 255); $table->string('wednesday', 255); $table->string('thursday', 255); + $table->unique('week'); $table->timestamps(); //$table->text('description'); }); diff --git a/skolehjem/resources/views/admin/washing-reservations/index.blade.php b/skolehjem/resources/views/admin/washing-reservations/index.blade.php index 587abea..073bbab 100644 --- a/skolehjem/resources/views/admin/washing-reservations/index.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/index.blade.php @@ -11,7 +11,7 @@ @section("content")