appends, $action); return $this; } /** * Prepend a action. * * @param $action * * @return $this */ public function prepend($action) { array_unshift($this->prepends, $action); return $this; } /** * Disable view action. * * @return $this */ public function disableView(bool $disable = true) { if ($disable) { array_delete($this->actions, 'view'); } elseif (!in_array('view', $this->actions)) { array_push($this->actions, 'view'); } return $this; } /** * Disable delete. * * @return $this. */ public function disableDelete(bool $disable = true) { if ($disable) { array_delete($this->actions, 'delete'); } elseif (!in_array('delete', $this->actions)) { array_push($this->actions, 'delete'); } return $this; } /** * Disable edit. * * @return $this. */ public function disableEdit(bool $disable = true) { if ($disable) { array_delete($this->actions, 'edit'); } elseif (!in_array('edit', $this->actions)) { array_push($this->actions, 'edit'); } return $this; } /** * Set resource of current resource. * * @param $resource * * @return $this */ public function setResource($resource) { $this->resource = $resource; return $this; } /** * Get resource of current resource. * * @return string */ public function getResource() { return $this->resource ?: parent::getResource(); } /** * {@inheritdoc} */ public function display($callbacks = []) { if (!empty($callbacks)) { foreach ($callbacks as $call) { if ($call instanceof \Closure) { $call->call($this, $this); } } } $actions = $this->prepends; foreach ($this->actions as $action) { $method = 'render'.ucfirst($action); array_push($actions, $this->{$method}()); } $actions = array_merge($actions, $this->appends); $actions_str=implode('', $actions); return << $actions_str EOT; } /** * Render view action. * * @return string */ protected function renderView() { return << EOT; } /** * Render edit action. * * @return string */ protected function renderEdit() { return << EOT; } protected function resume_checkout() { $tip = trans('admin.delete_person_resume_confirm'); $resume_checkout = ""; return $resume_checkout; } /** * Render delete action. * * @return string */ protected function renderDelete() { $title = ''; $url_pams = ''; if(strstr($this->getResource(),'firm/company') && !(strstr($this->getResource(),'firm/companyimg'))&& !(strstr($this->getResource(),'firm/companysetmeal'))) { $deleteConfirm = trans('admin.delete_company_confirm'); }elseif (strstr($this->getResource(),'personal/members')) { $deleteConfirm = trans('admin.delete_person_confirm'); } elseif (strstr($this->getResource(),'recycle/index')){ $scope = array_get(request()->all(),'scope',1); $url_pams='?scope='.$scope; $deleteConfirm = trans('admin.delete_confirm'); }elseif (strstr($this->getResource(),'personal/resume')){ $deleteConfirm = trans('admin.delete_confirm'); $title = $this->resume_checkout(); } else { $deleteConfirm = trans('admin.delete_confirm'); } $confirm = trans('admin.confirm'); $cancel = trans('admin.cancel'); $script = <<