示例#1
0
 protected function createGoal($year)
 {
     Store::findActive()->get()->each(function ($store) use($year) {
         for ($month = 1; $month <= 12; $month++) {
             $goal = StoreGoal::findByStore($store)->findByYear($year)->findByMonth($month)->first();
             if (!$goal) {
                 $goal = new StoreGoal();
                 $goal->store_id = $store->id;
                 $goal->year = $year;
                 $goal->month = $month;
                 $goal->save();
             }
         }
     });
 }
示例#2
0
 protected function getNorthGroup()
 {
     return $this->pluckSnFromStores(Store::findActive()->where('store_area_id', '=', 1)->get());
 }