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 + + - - - - - - - "; - for ($i = 1; $i <= 25; $i++){ - echo " - - - - - - - "; - } - echo "
Imie i nazwiskoPESELE-mailFunkcjaStopieńStatus
name surname???????????przykladowymail@domena.comZast. NaczelnikaDowódcaCzynny
"; - ?> + Imie i nazwisko + PESEL + E-mail + Funkcja + Stopień + Status + + + + @foreach($users as $user) + {{ $user->name }} surname + ??????????? + przykladowymail@domena.com + Zast. Naczelnika + Dowódca + Czynny + @endforeach + " + " + + @endif + @else + Brak autoryzacji + @endif + + @stop diff --git a/routes/web.php b/routes/web.php index 0392299..2beecac 100644 --- a/routes/web.php +++ b/routes/web.php @@ -43,21 +43,17 @@ Route::get('/login', 'SessionsController@create'); Route::post('/login', 'SessionsController@store'); Route::get('/logout', 'SessionsController@destroy'); -Route::get('/jednostka', 'fireStationController@create'); -Route::post('/jednostka', 'fireStationController@store'); - Route::get('/strazacy', 'fireFightersController@create'); Route::get('/strazacy/add', 'fireFightersController@addForm'); Route::post('/strazacy', 'fireFightersController@store'); +Route::get('/jednostka', 'fireStationController@create'); +Route::post('/jednostka', 'fireStationController@store'); + Route::get('/jednostka/getcounties/{id}','DataController@getCounties'); Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities'); -Route::get('register/verify/{confirmationCode}', [ - 'as' => 'confirmation_path', - 'uses' => 'RegistrationController@confirm' -]); //Auth::routes(); // //Route::get('/home', 'HomeController@index')->name('home');