Exemple #1
0
 /**
  * Returnerar true eller false beroende på om order existerar 
  * @param  $order_id
  * @return boolean
  */
 public static function exists($id)
 {
     return Order::whereOrder_id($id)->first() ? true : false;
 }
 public function getEvent($id)
 {
     $order = Order::whereOrder_id($id)->first();
     $event = Event::whereOrder_id($id)->first();
     return ['order' => $order, 'customer' => $order->customer()->first(), 'event' => $event];
 }
 public function comment(Request $request)
 {
     $order = Order::whereOrder_id($request->order_id)->first();
     if ($request->finished) {
         $order->finishIt($request->comment, $request->sign);
     } else {
         $order->commentIt($request->comment, $request->sign);
     }
     $event = $order->events()->orderBy('order_event_id', 'desc')->first();
     return ["event" => $event, "business" => $order->customer()->first()->business, "status" => $order->status, "prio" => $order->prio];
 }