component = $component ?? $this->component; } /** * Determine if the element should be displayed for the given request. * * @param \Illuminate\Http\Request $request * @return bool */ public function authorize(Request $request) { return $this->authorizedToSee($request); } /** * Get the component name for the element. * * @return string */ public function component() { return $this->component; } /** * Specify that the element should only be shown on the detail view. * * @return $this */ public function onlyOnDetail() { $this->onlyOnDetail = true; return $this; } /** * Prepare the element for JSON serialization. * * @return array */ public function jsonSerialize() { return array_merge([ 'component' => $this->component(), 'prefixComponent' => false, 'onlyOnDetail' => $this->onlyOnDetail, ], $this->meta()); } }