'Laravel Jetstream page not getting retrieved (403 forbidden error)

here are my folders in views:

1

here is the link connecting the tab to the index file under the folder users

<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
    <x-jet-nav-link href="{{ route('users.index') }}" :active="request()->routeIs('users.*')">
        Users
    </x-jet-nav-link>
</div>

here is the controller, (UsersController.php)

class UsersController extends Controller
{
    public function index()
    {
        abort_if(Gate::denies('user_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');

        $users = User::with('roles')->get();

        return view('users.index', compact('users'));
    }
}

here are my routes:

Route::group(['middleware' => 'auth'], function () {
    Route::resource('tasks', \App\Http\Controllers\TasksController::class);
    Route::resource('users', \App\Http\Controllers\UsersController::class);
});

How come I still get an 403 forbidden error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source