diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index 6d907ee..2a89190 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -34,11 +34,9 @@ class fireFightersController extends Controller public function addForm(){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $fireStation = fireStation::find(auth()->user()->fireStationID); - if($fireStation-> creatorID == auth()->user()->id){ //if do usunięcia w pzyszłości - $ranks = DB::table('ranks')->pluck("rank","id"); - $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id"); - return view('fireFightersAdd',compact('ranks'), compact('unitFunctions')); - } else return fireFightersController::create(); // ??? + $ranks = DB::table('ranks')->pluck("rank","id"); + $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id"); + return view('fireFightersAdd',compact('ranks'), compact('unitFunctions')); } else return redirect()->to('/strazacy'); } @@ -46,7 +44,6 @@ class fireFightersController extends Controller if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik $userFireStation = auth()->user()->fireStationID; $fireFighterFireStation = DB::table('users')->where("id", $id)->value('fireStationID'); - $fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID'); $fireFighter = DB::table('users')->where("id", $id)->first(); return view('fireFightersEdit', ["fireFighter" => $fireFighter]); @@ -113,6 +110,19 @@ class fireFightersController extends Controller 'surname' =>'required|min:2|max:45|regex:/^[A-Za-zżźćńółęąśŻŹĆĄŚĘŁÓŃ\040\x27-]+$/', 'PESEL' => new Pesel, 'phoneNumber' => 'required|digits:9', + 'secondName' => 'max:45', + 'fathersName' => 'max:45', + 'mothersName' => 'max:45', + 'homePhoneNumber' => 'max:20', + 'address' => 'max:45', + 'apartment'=> 'max:45', + 'placeOfBirth'=> 'max:45', + 'IDSeries'=> 'max:3', + 'IDNumber'=> 'max:6', + 'identityCardNumber'=> 'max:20', + 'driversLicense'=> 'max:20', + 'education'=> 'max:45', + 'profession'=> 'max:45', ], [ 'required' => ':attribute jest wymagany(e).', @@ -131,6 +141,22 @@ class fireFightersController extends Controller $fireFighter-> surname = $request->surname; $fireFighter-> PESEL = $request->PESEL; $fireFighter-> phoneNumber = $request->phoneNumber; + $fireFighter-> changingID = auth()->user()-> id; + $fireFighter-> secondName = $request->secondName; + $fireFighter-> fathersName = $request->fathersName; + $fireFighter-> mothersName = $request->mothersName; + $fireFighter-> homePhoneNumber = $request->homePhoneNumber; + $fireFighter-> address = $request->address; + $fireFighter-> apartment = $request->apartment; + $fireFighter-> placeOfBirth = $request->placeOfBirth; + $fireFighter-> joiningOSPDate = $request->joiningOSPDate; + $fireFighter-> IDSeries = $request->IDSeries; + $fireFighter-> IDNumber = $request->IDNumber; + $fireFighter-> IDValidUntil = $request->IDValidUntil; + $fireFighter-> identityCardNumber = $request->identityCardNumber; + $fireFighter-> driversLicense= $request->driversLicense; + $fireFighter-> education = $request->education; + $fireFighter-> profession = $request->profession; $fireFighter->save(); return fireFightersController::create(); diff --git a/resources/views/fireFightersEdit.blade.php b/resources/views/fireFightersEdit.blade.php index f919d03..04f1c31 100644 --- a/resources/views/fireFightersEdit.blade.php +++ b/resources/views/fireFightersEdit.blade.php @@ -24,16 +24,91 @@ +
+ + +
+ +
+ + +
+ +
+ + +
+
- +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+