Muhammad Sulman
Muhammad Sulman

Reputation: 1681

How to show Laravel Nova action without select any record from Nova Resource Listing/Index?

enter image description here

As seen in the image below. When we select the record from the listing than action drop down appear. But I need to show it always, either user selects some record or not.

Upvotes: 5

Views: 7435

Answers (3)

Mojtaba
Mojtaba

Reputation: 5004

Looking at the \Laravel\Nova\Actions\Action class, you probably need to add these to your custom action class:

    public $showInline          = true;
    public $sole                = true;

Upvotes: 0

daugaard47
daugaard47

Reputation: 1868

I know this is old, but hopefully it helps somebody. The Standalone Actions is what you're looking for. Not sure if this was a feature when @VolkerRose posted his answer.

Place this at the bottom of your Nova Resource.

    public function actions(Request $request)
    {
        return [
                Actions\ImportSalesForceRecords::make()->standalone(),
        ];
    }

enter image description here

I was really wanting the action button to be right next to the create button, but this will work.

Upvotes: 17

Volker Rose
Volker Rose

Reputation: 1818

Maybe "Inline Actions" can help you out? (Which are not really adequate covered over at https://nova.laravel.com/docs/3.0/actions/defining-actions.html.)

enter image description here

class SomeAction extends Action
{
    public $showOnTableRow = true;

    // [...]
}

If you are trying to limit your actions visibility with the canSee method, there is an existing issue regarding Inline Actions: https://nova.laravel.com/docs/3.0/actions/defining-actions.html#action-visibility.

Upvotes: 3

Related Questions