/** * Handle the command * * @param $command * @return mixed */ public function handle($command) { $contract = Contract::generate($command->attributes); $this->repository->save($contract); $this->dispatchEventsFor($contract); return $contract; }
/** * Update the specified contract in storage. * PUT /contracts/{id} * * @param int $id * @return Response */ public function update($id) { $this->contractForm->withRulesForUpdate($id)->validate(Input::all()); $contract = Contract::find($id); foreach ($this->contractForm->fields as $field) { $contract->{$field} = Input::get($field); } $contract->save(); return Redirect::to('contracts'); }