diff options
author | Mateja <mail@matejamaric.com> | 2020-11-01 17:03:12 +0100 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2020-11-01 17:03:12 +0100 |
commit | 0ce5bbcc443b9da12e5233a481f2ef15017ee891 (patch) | |
tree | aebdd93295c71ba576585940a42b8fb930328fd8 /app/Http/Controllers/SpecialCallsController.php | |
parent | 3e5dc09d0010078568f8590daef1f95722a4dd05 (diff) | |
download | yota-laravel-0ce5bbcc443b9da12e5233a481f2ef15017ee891.tar.gz yota-laravel-0ce5bbcc443b9da12e5233a481f2ef15017ee891.zip |
Callsign adding finished.
Diffstat (limited to 'app/Http/Controllers/SpecialCallsController.php')
-rw-r--r-- | app/Http/Controllers/SpecialCallsController.php | 17 |
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) |