where('id',$orderID) ->select('*','created_at as order_date','id as order_id' ,'status as order_status','customer_id','platform as order_platform') ->first(); if(!empty($order)){ if($order->checkout != 'guest'){ $customer = DB::table('customers')->where('id',$order->customer_id)->first(); $order->customer_name = $customer->name; $order->customer_phone = $customer->mobile_number; $order->customer_address = $customer->address; $order->customer_email = $customer->email; }else{ $order->customer_name = $order->g_name; $order->customer_phone = $order->g_phone; $order->customer_address = $order->g_address; $order->customer_email = $order->g_email; } } $this->data['order'] = $order; $this->data['order_detail'] = DB::table('takeaway_order_details')->where('order_id',$orderID)->get(); } /** * Build the message. * * @return $this */ public function build() { return $this->markdown('email.onlineorder')->with($this->data); } }