DEV Community

anditsung
anditsung

Posted on

3 1

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

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay