Example #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     //Check if exists
     $cost = Cost::exists($this->month, $this->year);
     if (!empty($cost)) {
         return $this->saveResponse(false);
     }
     $setting = Setting::first();
     $spend = Item::total($this->month, $this->year);
     $cost = Bus::dispatch(new CreateCostCommand($setting->salary, $setting->save, $spend));
     return $this->saveResponse($cost);
 }