From 66ac47c031ee345c2b33f81a2f4b3573aa7c02c0 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 20 Jul 2020 14:04:44 +0200 Subject: [PATCH 1/4] fix zlosliwej literowki --- app/Http/Controllers/userProfileController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/userProfileController.php b/app/Http/Controllers/userProfileController.php index a38ad4d..520ab62 100644 --- a/app/Http/Controllers/userProfileController.php +++ b/app/Http/Controllers/userProfileController.php @@ -14,7 +14,7 @@ class userProfileController extends Controller $userData = DB::table('users')->where("users.id", '=', auth()->user()->id) ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') - ->select('users.id','users.name', 'users.surname', 'users.PESEL','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number', 'users.secondName', 'users.fathersName', 'users.mothersName', 'users.address', 'users.apartment', 'users.placeOfBirth', 'users.driversLicense', 'users.joiningOSPDate', 'users.IDSeries', 'users.IDNumber', 'users.IDValidUntil', 'users.identityCardNumber', 'users.homePhoneNumber', 'users.education', 'users.profession',) + ->select('users.id','users.name', 'users.surname', 'users.PESEL','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number', 'users.secondName', 'users.fathersName', 'users.mothersName', 'users.address', 'users.apartment', 'users.placeOfBirth', 'users.driversLicense', 'users.joiningOSPDate', 'users.IDSeries', 'users.IDNumber', 'users.IDValidUntil', 'users.identityCardNumber', 'users.homePhoneNumber', 'users.education', 'users.profession') ->first(); return view("userProfile", ["userData" => $userData]); } else{ From c7dfa83343ca018d6d17e71bf369ce4a9fd4cf00 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 20 Jul 2020 14:42:50 +0200 Subject: [PATCH 2/4] czyszczenie starego kodu --- app/Http/Controllers/fireFightersController.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index cdb2ea8..6d907ee 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -49,12 +49,10 @@ class fireFightersController extends Controller $fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID'); $fireFighter = DB::table('users')->where("id", $id)->first(); - if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { // if do usunięcia w pzyszłości - return view('fireFightersEdit', ["fireFighter" => $fireFighter]); - } else{ - return "Brak dostepu"; - } - }else{ + return view('fireFightersEdit', ["fireFighter" => $fireFighter]); + } + else + { return redirect()->to('/strazacy'); } } From 9c2e7dbc5fb58c7b55cc6f0551a9149c38d1d5b7 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 20 Jul 2020 15:20:35 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Dodanie=20mo=C5=BCliwo=C5=9Bci=20edycji=20n?= =?UTF-8?q?owych=20danych=20stra=C5=BCaka=20przez=20prezesa=20i=20naczelni?= =?UTF-8?q?ka=20jednostki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/fireFightersController.php | 38 +++++++-- resources/views/fireFightersEdit.blade.php | 77 ++++++++++++++++++- 2 files changed, 108 insertions(+), 7 deletions(-) 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 @@ +
+ + +
+ +
+ + +
+ +
+ + +
+
- +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
From 586242aa3aeb3d1db19d492b811ca9c1bb19dc26 Mon Sep 17 00:00:00 2001 From: Krzysztof Strzelecki Date: Mon, 20 Jul 2020 16:09:02 +0200 Subject: [PATCH 4/4] =?UTF-8?q?uzupe=C5=82nienie=20modelu=20u=C5=BCytkowni?= =?UTF-8?q?ka=20+=20fix=20buga=20przy=20od=C5=9Bwierzaniu=20podstrony=20Wy?= =?UTF-8?q?jazdy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/operationsController.php | 4 +++- app/User.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php index 40e7d50..32d7c5e 100644 --- a/app/Http/Controllers/operationsController.php +++ b/app/Http/Controllers/operationsController.php @@ -240,7 +240,8 @@ class operationsController extends Controller }; } - return operationsController::create(); + //return operationsController::create(); + return redirect()->to('/wyjazdy'); } public function update(){ @@ -321,6 +322,7 @@ class operationsController extends Controller public function destroy($id) { operations::find($id)->delete($id); + //redirect()->to('/wyjazdy'); return response()->json([ 'success' => 'Record deleted successfully!' diff --git a/app/User.php b/app/User.php index 2b62596..d1e6eed 100644 --- a/app/User.php +++ b/app/User.php @@ -18,7 +18,7 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID', 'confirmation_code', + 'name', 'surname', 'password', 'PESEL', 'phoneNumber', 'email', 'fireStationID', 'functionID', 'degreeID', 'number', 'statusID', 'deleted', 'creatorID', 'changingID', 'confirmation_code','secondName','fathersName','mothersName','address','apartment','placeOfBirth','driversLicense','joiningOSPDate','IDSeries','IDNumber','IDValidUntil','identityCardNumber','homePhoneNumber','education','profession', ]; /**