/**
  * Invoke Action
  *
  * @param int $id Category id
  *
  * @return void
  * @throws \Rad\Core\Exception\BaseException
  */
 public function __invoke($id = null)
 {
     if ($id) {
         $categories = $this->getCategories($id);
         if ($this->getRequest()->isAjax()) {
             $categories = $categories->toArray();
             $categories['children'] = $this->getChildren($id, true)->toArray();
             $this->getResponder()->setData('categories', $categories);
         } else {
             $this->getResponder()->setData('form', Form::create()->getForm($categories));
         }
     } else {
         $this->getResponder()->setData('table', $this->getDataTable());
     }
 }
示例#2
0
 /**
  * Get method
  *
  * @throws \Rad\Core\Exception\BaseException
  */
 public function getMethod()
 {
     $this->getResponder()->setData('form', Form::create()->getForm());
 }