DEV Community

anditsung
anditsung

Posted on

disable view on laravel nova attach

to disable view on attach item add this to the resource that want to be disable to view

public function authorizedToView(Request $request)
{
    if($request->query->get("viaResource")) {
        return false; 
    }
    return true;
}
Enter fullscreen mode Exit fullscreen mode

"$request->query->get("viaResource")" to find if the resource is accessed from other resource

Discussion (0)