protected function __update($model, $data) { try { $record = $model::find($data['id']); $record->update($this->__prepare($data)); $result = \Result::make()->success(true)->message('Actualizare cu success.'); } catch (\Exception $e) { $result = \Result::make()->success(false)->message($e->getMessage()); } return \Response::json(['success' => $result->success(), 'message' => $result->message(), 'fieldserrors' => $result->fieldserrors()]); }
public function execute_delete() { try { $record = call_user_func([$this->model, 'deleteRecord'], $this->record_id, $this->data); if ($record) { return \Result::make()->success(true)->message($this->feedback('success')); } return \Result::make()->success(false)->message($this->feedback('error')); } catch (\Exception $e) { return \Result::make()->success(false)->message([$this->feedback('error'), $e->getMessage()]); } }