public function edit($entity) { parent::edit($entity); $this->edit = \DataEdit::source(new \App\Comments()); $this->edit->label('Edit Comment'); $this->edit->add('active', 'Active', 'checkbox'); /*its must be deleted*/ $this->edit->add('comment_id', 'ID', 'select')->options(\App\News::lists('id', 'id')->toArray()); $this->edit->add('name', 'Name', 'text'); $this->edit->add('comment', 'Comment', 'text'); /**/ return $this->returnEditView(); }
public function all($entity) { parent::all($entity); $this->filter = \DataFilter::source(new \App\News()); $this->filter->add('active', 'Active', 'select')->options(\App\News::lists("Active", "active")->all()); $this->filter->add('title', 'Title', 'text'); $this->filter->add('title_en', 'Title(EN)', 'text'); $this->filter->add('published_at', 'Pub. Date', 'datetime')->format('Y-m-d H:i:s', 'uk'); $this->filter->add('created_at', 'Created Date', 'datetime')->format('Y-m-d H:i:s', 'uk'); $this->filter->submit('search'); $this->filter->reset('reset'); $this->filter->build(); $this->grid = \DataGrid::source($this->filter); $this->grid->add('active', 'Active', 'active'); $this->grid->add('title', 'Title', 'title'); $this->grid->add('title_en', 'Title(En)', 'title_en'); $this->grid->add('segment', 'Segment'); $this->grid->add('content', 'Content'); $this->grid->add('published_at', 'Pub. Date', 'published_at'); $this->grid->add('created_at', 'Created Date', 'created_at'); $this->grid->add('img_url', 'Image'); $this->addStylesToGrid(); return $this->returnView(); }