aboutsummaryrefslogtreecommitdiff
path: root/app/Http/Controllers/SpecialCallsController.php
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-01 23:55:13 +0100
committerMateja <mail@matejamaric.com>2020-11-01 23:55:13 +0100
commiteb54ef5a24bc4af0749ad43ccffcbc1ae03aa4b6 (patch)
treebb9ff7cb37880577f664cff543e78b1bfc8dd1f5 /app/Http/Controllers/SpecialCallsController.php
parent3c410d2bac3e338ab6d6045577819e292251c066 (diff)
downloadyota-laravel-eb54ef5a24bc4af0749ad43ccffcbc1ae03aa4b6.tar.gz
yota-laravel-eb54ef5a24bc4af0749ad43ccffcbc1ae03aa4b6.zip
Special callsigns finished.
Diffstat (limited to 'app/Http/Controllers/SpecialCallsController.php')
-rw-r--r--app/Http/Controllers/SpecialCallsController.php41
1 files changed, 27 insertions, 14 deletions
diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php
index 2c63c22..dd05810 100644
--- a/app/Http/Controllers/SpecialCallsController.php
+++ b/app/Http/Controllers/SpecialCallsController.php
@@ -36,7 +36,7 @@ class SpecialCallsController extends Controller
$newcall->description = $request->description;
$newcall->saveOrFail();
- return Redirect::back()->with('status', 'Callsign added.');
+ return Redirect::back()->with('status', "Special callsign added.");
}
public function edit(Request $request, int $id)
@@ -47,21 +47,34 @@ class SpecialCallsController extends Controller
public function editForm(Request $request, int $id)
{
- $rules = [ 'sign' => 'required' ];
- $messages = [ 'sign.required' => 'You need to provide a callsign!' ];
- $validator = Validator::make($request->all(), $rules, $messages);
+ //dd($request->input('submit'));
+ if ($request->input('submit') == 'Edit callsign') {
+ $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();
- }
+ if ($validator->fails()) {
+ return Redirect::back()
+ ->withErrors($validator)
+ ->withInput();
+ }
- $data = SpecialCall::findOrFail($id);
- $data->sign = strtoupper($request->sign);
- $data->description = $request->description;
- $data->saveOrFail();
+ $data = SpecialCall::findOrFail($id);
+ $data->sign = strtoupper($request->sign);
+ $data->description = $request->description;
+ $data->saveOrFail();
+
+ return Redirect::route('addSign')->with('statusE', "Special callsign edited.");
+ } else return Redirect::route('addSign');
+ }
- return Redirect::back()->with('statusE', 'Callsign edited.');
+ public function delete(Request $request, int $id)
+ {
+ //SpecialCall::findOrFail($id)->delete();
+ $sign = SpecialCall::findOrFail($id);
+ $call = $sign->sign;
+ $sign->delete();
+ return Redirect::back()->with('statusE', "Special callsign $call deleted.");
}
+
}