Пример #1
0
 public function update(StoreGoalRequest $request, StoreGoal $goal)
 {
     $attr = $request->get('attr');
     $goal->{$attr} = $request->get('val');
     $goal->save();
     return $goal->id;
 }
Пример #2
0
 /**
  * 取得目前月份的目標(201601)
  * 
  * @return array
  */
 protected function getConfig($export)
 {
     $goalWithSnKey = [];
     $goals = StoreGoal::with(['store'])->findByYear($export->getDate()->format('Y'))->findByMonth($export->getDate()->format('m'))->get();
     foreach ($goals as $goal) {
         $goalWithSnKey[$goal->store->sn] = ['name' => $goal->store->name, 'goal' => $goal->origin_goal, 'pl' => $goal->pl_origin_goal];
     }
     return $goalWithSnKey;
 }