protected function processDatatables($datatables) { $datatables = parent::processDatatables($datatables); return $datatables->addColumn('category', function ($data) { return dataImplode($data->categories, 'category'); })->addColumn('client', function ($data) { return $data->client->name; }); }
protected function processDatatables($datatables) { $datatables = parent::processDatatables($datatables); $datatables = $datatables->addColumn('category', function ($data) { return dataImplode($data->categories, 'category'); })->addColumn('tag', function ($data) { return dataImplode($data->tags, 'tag'); }); if (Str::endsWith(get_called_class(), 'Backend\\ArticleController')) { return $datatables->editColumn('is_featured', function ($data) { return $data->is_featured ? Form::open(['style' => 'display: inline!important', 'method' => 'put', 'action' => [$this->baseClass . '@putUpdateFeatured', $data->{$this->model->getKeyName()}]]) . ' <button type="submit" name="is_featured" value="0" onClick="return confirm(\'' . $this->getTrans('unsetfeaturedconfirmation') . '\');" class="btn btn-small btn-link" title="' . $this->getTrans('unsetfeatured') . '"> <i class="fa fa-xs fa-star text-yellow"></i> </button> </form>' : Form::open(['style' => 'display: inline!important', 'method' => 'put', 'action' => [$this->baseClass . '@putUpdateFeatured', $data->{$this->model->getKeyName()}]]) . ' <button type="submit" name="is_featured" value="1" onClick="return confirm(\'' . $this->getTrans('setfeaturedconfirmation') . '\');" class="btn btn-small btn-link" title="' . $this->getTrans('setfeatured') . '"> <i class="fa fa-xs fa-star-o"></i> </button> </form>'; }); } return $datatables; }
function getArticleTags($article) { return dataImplode($article->tags, 'tag', function ($tag, $slug) { return '<a style="color: black" href="' . url(getSlug('tag') . '/' . $slug) . '">' . $tag . '</a>'; }, 'slug'); }