public function getOrder($id) { $order = Order::where('id', $id)->first(); if ($order === null) { $array = array('success' => false, 'message' => 'Order does not exist'); return json_encode($array); } $array = array('success' => true, 'order' => $order); return json_encode($array); }