value = $value; $this->grid = $grid; $this->column = $column; $this->setRow($row); $this->requireAssets(); } protected function requireAssets() { if (static::$js) { Admin::js(static::$js); } if (static::$css) { Admin::css(static::$css); } } protected function setRow($row) { if (is_array($row)) { $row = new Fluent($row); } $this->row = $row; } /** * @return string */ public function getElementName() { $name = explode('.', $this->column->getName()); if (count($name) == 1) { return $name[0]; } $html = array_shift($name); foreach ($name as $piece) { $html .= "[$piece]"; } return $html; } /** * Get key of current row. * * @return mixed */ public function getKey() { return $this->row->{$this->grid->getKeyName()}; } /** * Get url path of current resource. * * @return string */ public function resource() { return $this->grid->resource(); } /** * Get translation. * * @param string $text * * @return string|\Symfony\Component\Translation\TranslatorInterface */ protected function trans($text) { return trans("admin.$text"); } /** * Display method. * * @return mixed */ abstract public function display(); }