Odznaczenia - drobne poprawki

This commit is contained in:
Krzysztof Strzelecki 2020-01-02 14:20:35 +01:00
parent 0943faf263
commit ef95f03fa2
2 changed files with 17 additions and 7 deletions

View File

@ -73,16 +73,26 @@ class userProfileController extends Controller
public function userTrainings(){ public function userTrainings(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
$userTrainings = DB::table('trainingsfirefighters')->where("trainingsfirefighters.firefighterID", '=', auth()->user()->id) $userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', auth()->user()->id)
->leftJoin('trainings', 'trainingsfirefighters.trainingID', '=', 'trainings.id') ->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id')
->select('trainingsfirefighters.id','trainings.trainingName','trainingsfirefighters.dateOfComplete', 'trainingsfirefighters.dateOfExpiry') ->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry')
->get(); ->get();
//DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
//->whereNull('deleted_at')->get();
return view("userTrainings", ["userTrainings" => $userTrainings]); return view("userTrainings", ["userTrainings" => $userTrainings]);
} }
else{ else{
return redirect()->to('/login');; return redirect()->to('/login');;
} }
} }
public function userDecorations(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
$userDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', auth()->user()->id)
->whereNull('decorationsFirefighters.deleted_at')
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
->get();
return view("userDecorations", ["userDecorations" => $userDecorations]);
} else{
return "Brak dostepu";
}
}
} }

View File

@ -52,8 +52,8 @@ Route::post('/strazacy', 'fireFightersController@store');
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm'); Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
Route::post('/strazacy/edit', 'fireFightersController@update'); Route::post('/strazacy/edit', 'fireFightersController@update');
Route::get('/strazacy/odznaczenia/{id}', 'decorationsController@create'); Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
Route::post('/strazacy/odznaczenia/{id}', 'decorationsController@store'); Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
Route::resource('decorations', 'DecorationsController'); Route::resource('decorations', 'DecorationsController');
Route::get('/jednostka', 'fireStationController@create'); Route::get('/jednostka', 'fireStationController@create');