Esempio n. 1
0
 public function getTodayVotessCountAttribute()
 {
     $order = Order::today();
     if ($order == null) {
         return '0';
     }
     return Vote::where('order_id', '=', $order->id)->where('place_id', '=', $this->id)->count();
 }
Esempio n. 2
0
 public function order()
 {
     $order = Order::today();
     $me = Auth::user()->id;
     if (!($userOrder = UserOrder::where('user_id', '=', $me)->where('order_id', '=', $order->id)->first())) {
         $userOrder = new UserOrder();
     }
     $userOrder->user_id = $me;
     $userOrder->desc = Input::get('desc');
     $userOrder->order_id = $order->id;
     $userOrder->save();
     return Redirect::to('main');
 }
Esempio n. 3
0
 public static function myVote($me)
 {
     return Vote::where('user_id', '=', $me->id)->where('order_id', '=', Order::today()->id)->first();
 }