This commit is contained in:
cuneytsenturk
2017-11-18 15:23:20 +03:00
parent f78237f7ce
commit 6e7b9d6964
9 changed files with 86 additions and 33 deletions

View File

@ -102,14 +102,12 @@ class Invoices extends Controller
*
* @return Response
*/
public function printInvoice($invoice_id)
public function printInvoice(Invoice $invoice)
{
$sub_total = 0;
$tax_total = 0;
$paid = 0;
$invoice = Invoice::where('id', $invoice_id)->first();
foreach ($invoice->items as $item) {
$sub_total += ($item->price * $item->quantity);
$tax_total += ($item->tax * $item->quantity);
@ -136,14 +134,12 @@ class Invoices extends Controller
*
* @return Response
*/
public function pdfInvoice($invoice_id)
public function pdfInvoice(Invoice $invoice)
{
$sub_total = 0;
$tax_total = 0;
$paid = 0;
$invoice = Invoice::where('id', $invoice_id)->first();
foreach ($invoice->items as $item) {
$sub_total += ($item->price * $item->quantity);
$tax_total += ($item->tax * $item->quantity);
@ -177,10 +173,13 @@ class Invoices extends Controller
*
* @return Response
*/
public function payment(PaymentRequest $request)
public function payment(Invoice $invoice, PaymentRequest $request)
{
$invoice = Invoice::where(['id' => $request['invoice_id'], 'customer_id' => Auth::user()->customer->id])->first();
if (!$invoice) {
return response()->json(
);
}
// Fire the event to extend the menu
$result = event(new PaymentGatewayConfirm($request['payment_method'], $invoice));