I need print My collaborators who related with project_id in collaboration table. this is My dompdf controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use PDF;
use App\Collaboration;
class CollaboPDFController extends Controller
{
public function getPDF($id){
$collaborators = Collaboration::project();
$pdf = PDF::loadView('customer.customer');//,['collaborators'=>$collaborators]);
return $pdf->stream('customer.customer');
}
//
}
this is collaboration model scope function
public function scopeProject($query, $id)
{
return $query->where('project_id', $id);
}
and this is printing blade file customer.blade.php
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2>Test PDF</h2>
@if($collaborators)
@foreach( $collaborators as $collaborator)
<div>
<div>
<span>
<img src="" />
</span>
</div>
</div>
@endforeach
@endif
</body>
</html>
routes.php
Route::get('project/{project}/getPDF','CollaboPDFController@getPDF');
pdf link
<p><a href="/projects//getPDF">Collaborator Report</a></p>
but when I click pdf link laravel generated following error
NotFoundHttpException in RouteCollection.php line 161:
how can fix this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire