Пример #1
0
 public function count()
 {
     $total = 0;
     $orders = WellbeingOrder::current_orders()->get();
     foreach ($orders as $order) {
         if ($order->bundle() != null) {
             foreach ($order->bundle()->nights()->get() as $night) {
                 if ($night->id == $this->id) {
                     $total++;
                 }
             }
         }
     }
     return $this->orders()->count() + $total;
 }
Пример #2
0
 public function get_admin($current = 'current')
 {
     if ($current == 'current') {
         $year = Year::current_year();
     } else {
         $year = Year::find($current);
     }
     if ($year) {
         $nights = WellbeingNight::current_nights()->get();
         $orders = WellbeingOrder::current_orders()->get();
         return View::make('wellbeing.orders.admin')->with('nights', $nights)->with('year', $year)->with('orders', $orders);
     } else {
         return "Invalid ID";
     }
 }