2020-03-25 00:20:45 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class documentApplicationController extends Controller
|
|
|
|
{
|
|
|
|
public function create(){
|
|
|
|
|
|
|
|
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
|
|
|
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get();
|
2020-06-13 00:02:05 +02:00
|
|
|
$decoration = DB::table('decorations')->pluck('decorationName', 'id');
|
|
|
|
return view("documentApplicationForm")
|
|
|
|
->with(compact('decoration'))
|
|
|
|
->with(compact('fireFighters'));
|
|
|
|
|
2020-03-25 00:20:45 +01:00
|
|
|
} else{
|
|
|
|
return view('home');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function printPDF(){
|
|
|
|
if(auth()->user() != null && auth()->user()->fireStationID != null ) {
|
|
|
|
$request = request();
|
|
|
|
$test = new documentOverlayController();
|
2020-06-13 00:02:05 +02:00
|
|
|
|
|
|
|
$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->testPdf($userData, $request->decoration, $fireStation);
|
2020-03-25 00:20:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|