Skip to content

Instantly share code, notes, and snippets.

@m5lil
Created November 8, 2019 23:19
Show Gist options
  • Save m5lil/28a27bda5fd0ce5e5eb339945e2f7374 to your computer and use it in GitHub Desktop.
Save m5lil/28a27bda5fd0ce5e5eb339945e2f7374 to your computer and use it in GitHub Desktop.
Helper File #laravel #helper
if (! function_exists('home_route')) {
    /**
     * Return the route to the "home" page depending on authentication/authorization status.
     *
     * @return string
     */
    function home_route()
    {
        if (auth()->check()) {
            if (auth()->user()->can('view backend')) {
                return 'admin.dashboard';
            }
            return 'frontend.user.dashboard';
        }
        return 'frontend.index';
    }
}



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment