1
0
forked from s421507/eOSP2

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(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
$userTrainings = DB::table('trainingsfirefighters')->where("trainingsfirefighters.firefighterID", '=', auth()->user()->id)
->leftJoin('trainings', 'trainingsfirefighters.trainingID', '=', 'trainings.id')
->select('trainingsfirefighters.id','trainings.trainingName','trainingsfirefighters.dateOfComplete', 'trainingsfirefighters.dateOfExpiry')
$userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', auth()->user()->id)
->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id')
->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry')
->get();
//DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
//->whereNull('deleted_at')->get();
return view("userTrainings", ["userTrainings" => $userTrainings]);
}
else{
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::post('/strazacy/edit', 'fireFightersController@update');
Route::get('/strazacy/odznaczenia/{id}', 'decorationsController@create');
Route::post('/strazacy/odznaczenia/{id}', 'decorationsController@store');
Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
Route::resource('decorations', 'DecorationsController');
Route::get('/jednostka', 'fireStationController@create');