get api invoice by number
This commit is contained in:
parent
4d05971b50
commit
6dec413786
@ -36,11 +36,18 @@ class Invoices extends ApiController
|
|||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param Invoice $invoice
|
* @param $id
|
||||||
* @return \Dingo\Api\Http\Response
|
* @return \Dingo\Api\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(Invoice $invoice)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
// Check if we're querying by id or number
|
||||||
|
if (is_numeric($id)) {
|
||||||
|
$invoice = Invoice::find($id);
|
||||||
|
} else {
|
||||||
|
$invoice = Invoice::where('invoice_number', $id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->response->item($invoice, new Transformer());
|
return $this->response->item($invoice, new Transformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user