Edit

Show

--

About

This CRUD operation allows your admins to preview an entry. When enabled, it will add a "Preview" button in the ListEntries view, that points to a show page:

Backpack CRUD Show Operation

In case your entity is translatable, it will show a multi-language dropdown, just like Edit.

How it Works

The /entity-name/{id} route points to the show() method in your EntityCrudController. Inside this method, it uses setFromDb() to try to magically figure out all attributes you would like shown for this Model, and shows them using Column types inside show.blade.php.

How to Use

The ListEntries operations is disabled by default. To enable it, you should use $this->crud->allowAccess('show'); inside your setup() method.This will make a Preview button appear in the table view, and allow access to the show view.

This view uses the same column types you've defined in setup() and adds all other fillable attributes on the model. If you need to hide a ListEntries column from the Show operation, you can specify 'visibleInShow' => false, to the column in setup(), and it will be hidden from the preview page.

If you need more customization (add/change/remove columns), check out How to Overwrite.

How to Overwrite

In case you need to add/change/remove any columns, create a show() method in your EntityCrudController. Using the addColumn() you're already familiar with, you can change how those attributes are shown to the admin. For example:

public function show($id)
{
    $content = parent::show($id);

    $this->crud->addColumn([
        'name' => 'table',
        'label' => 'Table',
        'type' => 'table',
        'columns' => [
            'name'  => 'Name',
            'desc'  => 'Description',
            'price' => 'Price',
        ]
    ]);
    $this->crud->addColumn([
        'name' => 'fake_table',
        'label' => 'Fake Table',
        'type' => 'table',
        'columns' => [
            'name'  => 'Name',
            'desc'  => 'Description',
            'price' => 'Price',
        ],
    ]);
    $this->crud->addColumn('text');
    $this->crud->removeColumn('date');
    $this->crud->removeColumn('extras');

    return $content;
}

Like our open-core?

Then you'll love our premium add-ons - productivity tools and tons of new features.