public function invoice($id) { $transaction = Transaction::findOrFail($id); if ($this->user->id == $transaction->user_id) { $pdf = storage_path() . '/invoices/' . $transaction->reference_number . '.pdf'; if (file_exists($pdf)) { return Response::download($pdf); } else { return Redirect::to('clients')->with('error', 'PDF was not found.'); } } else { return App::abort(404); } }
public function transaction($id) { $transaction = Transaction::findOrFail($id); $pdf = storage_path() . '/invoices/' . $transaction->reference_number . '.pdf'; if (file_exists($pdf)) { return Response::download($pdf); } else { return Redirect::to('admin/clients')->with('error', 'PDF was not found.'); } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function invoice($id) { $transaction = $this->transaction->findOrFail($id); $pdf = storage_path() . '/invoices/' . $transaction->reference_number . '.pdf'; return Response::download($pdf); }