Skip to content

Instantly share code, notes, and snippets.

@brunokunace
Created March 15, 2018 17:23
Show Gist options
  • Select an option

  • Save brunokunace/43dda2112ad70f559e2c77f4bed1fcec to your computer and use it in GitHub Desktop.

Select an option

Save brunokunace/43dda2112ad70f559e2c77f4bed1fcec to your computer and use it in GitHub Desktop.
public function getAllOrders($status = null)
{
$origin = auth()->user();
$montages = Montage::where('origin_id', '=', $origin->id);
if ($status) {
$montages->where('status', '=', $status);
}
if (!$montages) {
return response()->json([
'status' => 'success',
'data' => 'No Records Found'
]);
}
return response()->json([
'status' => 'success',
'data' => $montages
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment