aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-10-31 21:10:32 +0100
committerMateja <mail@matejamaric.com>2020-10-31 21:10:32 +0100
commit2140f96e655d71c4f388ff102babd306bcaad218 (patch)
tree661644b7a1f9f2f9fc5bda6f4d25550db1dec58b
parentcde26dcfbbc7cc00080492b03cb4f4d8cdb966f6 (diff)
downloadyota-laravel-2140f96e655d71c4f388ff102babd306bcaad218.tar.gz
yota-laravel-2140f96e655d71c4f388ff102babd306bcaad218.zip
Don't use foreign keys for special calls.
-rw-r--r--app/Http/Controllers/SpecialCallsController.php19
-rw-r--r--database/migrations/2020_10_19_210000_create_reservations_table.php5
-rw-r--r--resources/views/pages/reserve.blade.php5
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 @@
<div class="form-group">
<label for="special-call">Special Callsign:</label>
<select class="form-control @error('scall') is-invalid @enderror" id="special-call" name="scall" required>
- <option value="YT50SCWC">YT50SCWC</option>
+ {{--<option value="YT50SCWC">YT50SCWC</option>--}}
+ @foreach ($signs as $sign)
+ <option value="{{ $sign->sign }}">{{ $sign->sign }}</option>
+ @endforeach
</select>
@error('scall')
<div class="alert alert-danger mt-2">{{ $message }}</div>