/** * Execute custom action on model. * * @param string $entity * @param $id * @param string $action * * @return \Illuminate\Http\Response */ public function executeCustomAction($entity, $id, $action = null) { $entity = $this->resolve($entity, Entity::UPDATE); $this->assertEntity($entity); $data = new EntityData($entity, []); $data->setId($id); $data->setCustomAction($action); $data->save(); return new JsonResponse(); }
/** * @param Model $model */ protected function fillModel(Model $model) { parent::fillModel($model); $this->relation->attach($model, $this->parent); }