Chron
2 months ago
168
1
Laravel

Prevent user access if there's no record

Posted 2 months ago by Chron

Is there a way to prevent a user from accessing a route if there's no record? Is there a way to do all of that in one file? Kind of like how view composer works?

//view composer

view()->composer('*', function ($view){
            $view->with('user_count', User::count());
})

Please sign in or create an account to participate in this conversation.