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

Dave Wize's avatar

Remove the forms from a nova resource

I want to remove the create new {model} button from certian nova resources (so there is no actally any forms , only details and index views), is it possible?

0 likes
1 reply
LaryAI's avatar
Level 58

Yes, it is possible to remove the create new button and forms from certain Nova resources. You can achieve this by customizing the resource's fields method in the corresponding resource file.

Here's an example of how to remove the create new button and forms from a Post resource:

use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Resource;

class Post extends Resource
{
    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = 'App\Post';

    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
            Text::make('Title'),
            Text::make('Body'),
        ];
    }

    /**
     * Determine if the user can create new resources.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return bool
     */
    public static function authorizedToCreate(Request $request)
    {
        return false;
    }
}

In the above example, we have overridden the fields method to only include the ID, Title, and Body fields. We have also overridden the authorizedToCreate method to return false, which disables the create new button and form.

You can customize the fields and authorizedToCreate methods to suit your specific needs for each resource.

Please or to participate in this conversation.