aboutsummaryrefslogtreecommitdiff
path: root/app/Http
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-01 17:03:12 +0100
committerMateja <mail@matejamaric.com>2020-11-01 17:03:12 +0100
commit0ce5bbcc443b9da12e5233a481f2ef15017ee891 (patch)
treeaebdd93295c71ba576585940a42b8fb930328fd8 /app/Http
parent3e5dc09d0010078568f8590daef1f95722a4dd05 (diff)
downloadyota-laravel-0ce5bbcc443b9da12e5233a481f2ef15017ee891.tar.gz
yota-laravel-0ce5bbcc443b9da12e5233a481f2ef15017ee891.zip
Callsign adding finished.
Diffstat (limited to 'app/Http')
-rw-r--r--app/Http/Controllers/SpecialCallsController.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php
index 72da6b9..073bf6e 100644
--- a/app/Http/Controllers/SpecialCallsController.php
+++ b/app/Http/Controllers/SpecialCallsController.php
@@ -103,7 +103,22 @@ class SpecialCallsController extends Controller
public function addForm(Request $request)
{
- return Redirect::back();
+ $rules = [ 'sign' => 'required' ];
+ $messages = [ 'sign.required' => 'You need to provide a callsign!' ];
+ $validator = Validator::make($request->all(), $rules, $messages);
+
+ if ($validator->fails()) {
+ return Redirect::back()
+ ->withErrors($validator)
+ ->withInput();
+ }
+
+ $newcall = new SpecialCall();
+ $newcall->sign = strtoupper($request->sign);
+ $newcall->description = $request->description;
+ $newcall->saveOrFail();
+
+ return Redirect::back()->with('status', 'Callsign added.');
}
public function reservations(Request $request)