What I need is that when I click on the "Register Passage" button, in addition to saving the registration, it should print a pdf for me.
The "Store" action does it very well, the problem is that the "pasajeImpreso" action does not execute me.
Both separately if they work.
{!!Form::open(array('url'=>'generar/pasaje','method'=>'POST','autocomplete'=>'off'))!!}
{{Form::token()}}
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<a href="{{URL::action('PasajeController@pasajeImpreso')}}" target="_blank">
<button class="btn btn-md btn-block btn-primary" type="submit">Registrar Pasaje</button>
</a>
</div>
{!!Form::close()!!}
This is my Printedpass() action:
public function pasajeImpreso()
{
$query = DB::table('pasajes as p')
->
$view = \View::make('generar.pasaje.pasajeImpreso')->render();
$pdf = \App::make('dompdf.wrapper');
$pdf->loadHTML($view);
return $pdf->stream('Pasaje');
}
The route for the PrintedPassenger action is this:
Route::get('pasaje_impreso', ['uses' => 'PasajeController@pasajeImpreso']);
For this purpose I am using the barryvdh/laravel-dompdf package