user() != null && auth()->user()->fireStationID != null ){ $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $decoration = DB::table('decorations')->pluck('decorationName', 'id'); return view("wniosekNadanieForm") ->with(compact('decoration')) ->with(compact('fireFighters')); } else{ return view('home'); } } public function createKartaEwidencyjnaForm(){ if(auth()->user() != null && auth()->user()->fireStationID != null ){ $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $decoration = DB::table('decorations')->pluck('decorationName', 'id'); return view("kartaEwidencyjnaForm") ->with(compact('fireFighters')); }else{ return view('home'); } } public function printWniosekNadaniePDF(){ if(auth()->user() != null && auth()->user()->fireStationID != null ) { $request = request(); $test = new documentOverlayController(); $userData = DB::table('users')->where("users.id", '=', $request->fireFighterID) ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number') ->first(); $fireStation = DB::table('fireStations')->where("id", '=', $userData->fireStationID)->first(); $test->wniosekNadaniePDF($userData, $request->decoration, $fireStation); } } public function printKartaEwidencyjnaPDF(){ if(auth()->user() != null && auth()->user()->fireStationID != null ) { $request = request(); $test = new documentOverlayController(); $userData = DB::table('users')->where("users.id", '=', $request->fireFighterID) ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.fireStationID','users.phoneNumber', 'users.email', 'ranks.rank', 'unitFunctions.unitFunction', 'users.number') ->first(); $userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', $request->fireFighterID) ->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id') ->get(); $fireStation = DB::table('fireStations')->where("id", '=', $userData->fireStationID)->first(); $test->kartaEwidencyjnaPDF($userData, $fireStation, $userTrainings); } } }