<?php

use App\Http\Controllers\KehadiranController;
use App\Http\Controllers\ResultController;
use App\Result;
use Illuminate\Support\Facades\Route;
use Barryvdh\DomPDF\PDF;
use Illuminate\Support\Facades\App;



/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/result/{id}', [ResultController::class, 'index']);


Route::get('/pdftest', function(){

    $result=Result::all();
    $pdf = App::make('dompdf.wrapper');
    $pdf->loadView('report.result-2',compact('result'));
    return $pdf->stream();
    // $pdf = PDF::loadView('report.result-2');
    // return $pdf->download('result.pdf');
});

Route::get('/kehadiranpdf/{id}', [KehadiranController::class, 'index']);


Route::view('/{any}', 'index')->where('any', '.*');
