From 2140f96e655d71c4f388ff102babd306bcaad218 Mon Sep 17 00:00:00 2001 From: Mateja Date: Sat, 31 Oct 2020 21:10:32 +0100 Subject: Don't use foreign keys for special calls. --- app/Http/Controllers/SpecialCallsController.php | 19 ++++++++++--------- .../2020_10_19_210000_create_reservations_table.php | 5 +++-- resources/views/pages/reserve.blade.php | 5 ++++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php index 421e85d..2f3282d 100644 --- a/app/Http/Controllers/SpecialCallsController.php +++ b/app/Http/Controllers/SpecialCallsController.php @@ -17,20 +17,21 @@ class SpecialCallsController extends Controller { public function activities(Request $request) { - //$activities = Reservation::all(); - $activities = Reservation::addSelect([ - 'specialCall' => SpecialCall::select('sign') - //->whereColumn('reservations.specialCall', 'special_calls.id') - ->whereColumn('specialCall', 'id') - ->limit(1) - ])->get(); + $activities = Reservation::all(); + //$activities = Reservation::addSelect([ + //'specialCall' => SpecialCall::select('sign') + ////->whereColumn('reservations.specialCall', 'special_calls.id') + //->whereColumn('specialCall', 'id') + //->limit(1) + //])->get(); return view('pages.activities', compact('activities')); } public function reserve(Request $request) { - return view('pages.reserve'); + $signs = SpecialCall::all(); + return view('pages.reserve', compact('signs')); } public function reserveForm(Request $request) @@ -79,7 +80,7 @@ class SpecialCallsController extends Controller $reservation = new Reservation(); - $reservation->specialCall = 2; + $reservation->specialCall = $request->scall; $reservation->fromTime = $request->sdate . ' ' . $request->stime; $reservation->toTime = $request->edate . ' ' . $request->etime; $reservation->frequencies = implode(', ', $request->freqs); diff --git a/database/migrations/2020_10_19_210000_create_reservations_table.php b/database/migrations/2020_10_19_210000_create_reservations_table.php index ad24f3d..6709d88 100644 --- a/database/migrations/2020_10_19_210000_create_reservations_table.php +++ b/database/migrations/2020_10_19_210000_create_reservations_table.php @@ -16,7 +16,8 @@ class CreateReservationsTable extends Migration Schema::create('reservations', function (Blueprint $table) { $table->id(); $table->boolean('approved')->default(false); - $table->unsignedBigInteger('specialCall'); + //$table->unsignedBigInteger('specialCall'); + $table->string('specialCall', 50); $table->dateTime('fromTime'); $table->dateTime('toTime'); $table->string('frequencies', 255); @@ -27,7 +28,7 @@ class CreateReservationsTable extends Migration $table->string('operatorPhone', 50); $table->integer('qso')->default(0); $table->timestamps(); - $table->foreign('specialCall')->references('id')->on('special_calls'); + //$table->foreign('specialCall')->references('id')->on('special_calls'); }); } diff --git a/resources/views/pages/reserve.blade.php b/resources/views/pages/reserve.blade.php index fcb8fd4..16bdda5 100644 --- a/resources/views/pages/reserve.blade.php +++ b/resources/views/pages/reserve.blade.php @@ -21,7 +21,10 @@
@error('scall')
{{ $message }}
-- cgit v1.2.3