Esempio n. 1
0
 /**
  * Execute the job.
  *
  * @return bool
  */
 public function handle()
 {
     $this->metric->user_id = auth()->id();
     $this->metric->name = $this->request->input('name');
     $this->metric->symbol = $this->request->input('symbol');
     return $this->metric->save();
 }
 public function run()
 {
     DB::table('locations')->delete();
     //Create Location
     $location = new Location();
     $location->name = 'Nonlocated';
     $location->save();
     $location = new Location();
     $location->name = 'Tools';
     $location->save();
     DB::table('metrics')->delete();
     $metric = new Metric();
     $metric->name = "Stk";
     $metric->symbol = "stk";
     $metric->save();
 }
Esempio n. 3
0
 public function store()
 {
     //
     $rules = array('unit_of_issue' => 'required|unique:metrics,name');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return redirect()->to('metric.index')->withErrors($validator);
     } else {
         // store
         $metric = new Metric();
         $metric->name = Input::get('unit_of_issue');
         $metric->description = Input::get('description');
         try {
             $metric->save();
             $url = session('SOURCE_URL');
             return redirect()->to('metric.index')->with('message', trans('messages.metric-succesfully-added'));
         } catch (QueryException $e) {
             Log::error($e);
         }
     }
 }
Esempio n. 4
0
 /**
  * Execute the job.
  *
  * @return bool
  */
 public function handle()
 {
     $this->metric->name = $this->request->input('name', $this->metric->name);
     $this->metric->symbol = $this->request->input('symbol', $this->metric->symbol);
     return $this->metric->save();
 }