forked from s421507/eOSP2
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?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();
|
|
$decoration = DB::table('decorations')->pluck('decorationName', 'id');
|
|
return view("documentApplicationForm")
|
|
->with(compact('decoration'))
|
|
->with(compact('fireFighters'));
|
|
|
|
} else{
|
|
return view('home');
|
|
}
|
|
|
|
}
|
|
|
|
public function printPDF(){
|
|
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->testPdf($userData, $request->decoration, $fireStation);
|
|
}
|
|
}
|
|
}
|