public function setEntity(Entity $entity) { $this->entity = $entity; if ($this->entity) { $this->setModel(app($entity->updateClass())); $this->model->underlyingQuery()->where('entity_id', $this->entity->id); } }