model binding
This commit is contained in:
@ -459,36 +459,33 @@ class Bills extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the invoice as sent.
|
||||
* Mark the bill as received.
|
||||
*
|
||||
* @param int $invoice_id
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function markReceived($bill_id)
|
||||
public function markReceived(Bill $bill)
|
||||
{
|
||||
$bill = Bill::find($bill_id);
|
||||
$bill->bill_status_code = 'received';
|
||||
$bill->save();
|
||||
|
||||
flash(trans('bills.marked_received'))->success();
|
||||
flash(trans('bills.messages.received'))->success();
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
* Print the bill.
|
||||
*
|
||||
* @param int $bill_id
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function printBill($bill_id)
|
||||
public function printBill(Bill $bill)
|
||||
{
|
||||
$paid = 0;
|
||||
|
||||
$bill = Bill::where('id', $bill_id)->first();
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
|
||||
@ -501,18 +498,16 @@ class Bills extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
* Download the PDF file of bill.
|
||||
*
|
||||
* @param int $bill_id
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function pdfBill($bill_id)
|
||||
public function pdfBill(Bill $bill)
|
||||
{
|
||||
$paid = 0;
|
||||
|
||||
$bill = Bill::where('id', $bill_id)->first();
|
||||
|
||||
foreach ($bill->payments as $item) {
|
||||
$item->default_currency_code = $bill->currency_code;
|
||||
|
||||
@ -532,7 +527,7 @@ class Bills extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
* Add payment to the bill.
|
||||
*
|
||||
* @param PaymentRequest $request
|
||||
*
|
||||
|
@ -393,13 +393,12 @@ class Invoices extends Controller
|
||||
/**
|
||||
* Mark the invoice as sent.
|
||||
*
|
||||
* @param int $invoice_id
|
||||
* @param Invoice $invoice
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function markSent($invoice_id)
|
||||
public function markSent(Invoice $invoice)
|
||||
{
|
||||
$invoice = Invoice::find($invoice_id);
|
||||
$invoice->invoice_status_code = 'sent';
|
||||
$invoice->save();
|
||||
|
||||
@ -411,15 +410,14 @@ class Invoices extends Controller
|
||||
/**
|
||||
* Mark the invoice as paid.
|
||||
*
|
||||
* @param int $invoice_id
|
||||
* @param Invoice $invoice
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function payInvoice($invoice_id)
|
||||
public function payInvoice(Invoice $invoice)
|
||||
{
|
||||
$invoice = Invoice::find($invoice_id);
|
||||
|
||||
$paid = 0;
|
||||
|
||||
foreach ($invoice->payments as $item) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
@ -447,16 +445,14 @@ class Invoices extends Controller
|
||||
/**
|
||||
* Print the invoice.
|
||||
*
|
||||
* @param int $invoice_id
|
||||
* @param Invoice $invoice
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function printInvoice($invoice_id)
|
||||
public function printInvoice(Invoice $invoice)
|
||||
{
|
||||
$paid = 0;
|
||||
|
||||
$invoice = Invoice::find($invoice_id);
|
||||
|
||||
foreach ($invoice->payments as $item) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
@ -475,16 +471,14 @@ class Invoices extends Controller
|
||||
/**
|
||||
* Download the PDF file of invoice.
|
||||
*
|
||||
* @param int $invoice_id
|
||||
* @param Invoice $invoice
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function pdfInvoice($invoice_id)
|
||||
public function pdfInvoice(Invoice $invoice)
|
||||
{
|
||||
$paid = 0;
|
||||
|
||||
$invoice = Invoice::find($invoice_id);
|
||||
|
||||
foreach ($invoice->payments as $item) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
|
Reference in New Issue
Block a user