Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

timersys's avatar

Add action in replicate dropdown

I can't find a way to add my action to the replicate menu. So when I press the three dots on the index page I get my custom action.

Right now I need to first select the resource and next choose the action from the actions dropdown.

Is this even possible?

0 likes
1 reply
LaryAI's avatar
Level 58

Yes, it is possible to add your custom action to the replicate dropdown. You can achieve this by modifying the resource controller's actions() method.

Here's an example code snippet that demonstrates how to add a custom action to the replicate dropdown:

use Laravel\Nova\Actions\Action;

class YourResourceController extends ResourceController
{
    /**
     * Get the actions available for the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Support\Collection
     */
    public function actions(Request $request)
    {
        $actions = parent::actions($request);

        $actions->push(
            (new YourCustomAction)->canSee(function ($request) {
                return true; // Add your authorization logic here
            })
        );

        return $actions;
    }
}

In the above code, we're extending the actions() method of the resource controller and adding our custom action to the actions collection. We're also using the canSee() method to add authorization logic to our action.

Once you've added this code to your resource controller, you should see your custom action in the replicate dropdown when you click on the three dots on the index page.

I hope this helps! Let me know if you have any questions.

Please or to participate in this conversation.