/** * Get from query */ public function get($page = null) { return $this->query(PurchaseOrder::with('supplier', 'client', 'items'), $page); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // Retrieve all the purchase orders in the database and return them $purchaseOrders = PurchaseOrder::with('customer')->orderBy('created_at', 'desc')->get(); return $purchaseOrders; }