diff --git a/app/Http/Controllers/DataController.php b/app/Http/Controllers/DataController.php index 2b1763b..0477f13 100644 --- a/app/Http/Controllers/DataController.php +++ b/app/Http/Controllers/DataController.php @@ -15,15 +15,15 @@ class DataController extends Controller } */ - public function getCounties($id) + public function getCounties($id) { $counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id"); return json_encode($counties); } - public function getCommunities($id) + public function getCommunities($id) { $communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id"); return json_encode($communities); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/fireFightersController.php b/app/Http/Controllers/fireFightersController.php index 59e2f3f..cf3ec97 100644 --- a/app/Http/Controllers/fireFightersController.php +++ b/app/Http/Controllers/fireFightersController.php @@ -7,11 +7,20 @@ use Illuminate\Http\Request; use App\User; use App\fireStation; use App\Rules\Pesel; +use Illuminate\Support\Facades\DB; class fireFightersController extends Controller { public function create(){ - return view('fireFighters'); + + if(auth()->user() != null && auth()->user()->fireStationID != null ){ +// $users = DB::table('Users')->where("fireStationID", auth()->user()->fireStationID); + $users = user::where("fireStationID", auth()->user()->fireStationID); + return view("fireFighters", ["users" => $users]); + } else{ + return view('fireFighters'); + } + } public function addForm(){ @@ -63,5 +72,9 @@ class fireFightersController extends Controller return view('fireFighters'); } + + public function editFireFighter(){ + + } } diff --git a/app/Http/Controllers/fireStationController.php b/app/Http/Controllers/fireStationController.php index f446c8d..4f9de4d 100644 --- a/app/Http/Controllers/fireStationController.php +++ b/app/Http/Controllers/fireStationController.php @@ -35,7 +35,7 @@ class fireStationController extends Controller 'KRS' => 'required|digits:10', 'NIP' => 'required|digits:10', 'phoneNumber' => 'required|digits:9', - 'email' => 'required|email|unique:firestations', + 'email' => 'required|email|unique:fireStations', ], [ 'required' => ':attribute jest wymagany(e).', diff --git a/resources/views/fireFighters.blade.php b/resources/views/fireFighters.blade.php index 1c666a2..f64ae7b 100644 --- a/resources/views/fireFighters.blade.php +++ b/resources/views/fireFighters.blade.php @@ -13,26 +13,37 @@ @section('center-area') @parent - + @if( auth()->check()) + @if( auth()->user()->fireStationID == NULL) + Jednostka nie istnieje + @else + +
Imie i nazwisko | -PESEL | -Funkcja | -Stopień | -Status | -|
name surname | -??????????? | -przykladowymail@domena.com | -Zast. Naczelnika | -Dowódca | -Czynny | -