when I will download the pdf, its just show 404 page and no file downloaded
view:
<a href="/report/cetak_pdf" class="btn btn-primary" target="_blank">CETAK PDF</a>
<div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
<?php
controller:
<?php
namespace App\Http\Controllers;
use App\Report_model;
use Illuminate\Support\Facades\Storage;
use Image;
use Illuminate\Http\Request;
use pdf;
class ReportController extends Controller
{
public function index(){
$menu_active=0;
$order=Report_model::all();
return view('backEnd.report.index',compact('menu_active','order'));
}
public function cetak_pdf()
{
$order=Report_model::all();
$pdf = PDF::loadView('backEnd.report.pdf', $order);
return $pdf->download('report.pdf');
}
}
route:
Route::resource('/report','ReportController');
Route::get('/report/cetak_pdf', 'PegawaiController@cetak_pdf');
I tried Googling a lot but I am really lost at this point, can someone be so kind to point a lost developer in the right direction? :) Thank you for your time in advance!
your route in using PegawaiController
which probably must be ReportController
Route::get('/report/cetak_pdf', 'ReportController@cetak_pdf');
and change the order of the routes:
Route::get('/report/cetak_pdf', 'ReportController@cetak_pdf');
Route::resource('/report','ReportController');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.