Skip to content
Discussion options

You must be logged in to vote

Nova disables global scope by default in detail query in order to allow the user to access trashed models, however you can re-enable it by adding the following to each resource or App\Nova\Resource:

    /**
     * Build a "detail" query for the given resource.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
     * @param  \Illuminate\Database\Eloquent\Builder  $query
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public static function detailQuery(NovaRequest $request, $query)
    {
        static::newModel()->registerGlobalScopes($query);

        return parent::detailQuery($request, $query);
    }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by juhotaipale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4113 on April 26, 2022 09:26.