src/Resources/Tag.php
/**
     * Get the fields displayed by the resource.
     */
Get the fields displayed by the resource.
Get the fields displayed by the resource .
public function fields(Request $request): array
    {
        $resources = config('nova-blog.resources');
        return [
            ID::make()->sortable(),
            Text::make(__('Slug'), 'slug')
                ->help(__('Will be filled automatically if leave empty'))
                ->rules('nullable', 'string', 'max:255')
                ->hideFromIndex(),
            Text::make(__('Name'), 'name')
                ->rules('required', 'string', 'max:255')
                ->hideFromIndex()
                ->hideFromDetail(),
            Text::make(__('Name'), 'name', function () {
                return sprintf('<a href="%s" title="%s" target="_blank">%s</a>',
                    $this->url, __('Open posts of tag in new window'), $this->name
                );
            })
                ->asHtml()
                ->hideWhenCreating()
                ->hideWhenUpdating()
                ->sortable(),
            DateTime::make(__('Created At'), 'created_at')
                ->hideWhenCreating()
                ->hideWhenUpdating()
                ->sortable(),
            DateTime::make(__('Updated At'), 'updated_at')
                ->hideWhenCreating()
                ->hideWhenUpdating()
                ->sortable(),
            BelongsToMany::make(__('Posts'), 'posts', $resources['post']),
        ];
    }
public function fields ( Request $ request ) : array { $ resources = config ( 'nova-blog.resources' ) ; return [ ID :: make ( ) -> sortable ( ) , Text :: make ( __ ( 'Slug' ) , 'slug' ) -> help ( __ ( 'Will be filled automatically if leave empty' ) ) -> rules ( 'nullable' , 'string' , 'max:255' ) -> hideFromIndex ( ) , Text :: make ( __ ( 'Name' ) , 'name' ) -> rules ( 'required' , 'string' , 'max:255' ) -> hideFromIndex ( ) -> hideFromDetail ( ) , Text :: make ( __ ( 'Name' ) , 'name' , function ( ) { return sprintf ( '<a href="%s" title="%s" target="_blank">%s</a>' , $ this -> url , __ ( 'Open posts of tag in new window' ) , $ this -> name ) ; } ) -> asHtml ( ) -> hideWhenCreating ( ) -> hideWhenUpdating ( ) -> sortable ( ) , DateTime :: make ( __ ( 'Created At' ) , 'created_at' ) -> hideWhenCreating ( ) -> hideWhenUpdating ( ) -> sortable ( ) , DateTime :: make ( __ ( 'Updated At' ) , 'updated_at' ) -> hideWhenCreating ( ) -> hideWhenUpdating ( ) -> sortable ( ) , BelongsToMany :: make ( __ ( 'Posts' ) , 'posts' , $ resources [ 'post' ] ) , ] ; }
Get the fields displayed by the resource.
Get the fields displayed by the resource .