previously i had two get routes for getting all users and create users now i used route resource and the got the error above
my navigation.blade.php component ```
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<x-nav-link href="{{ route('register') }}" :active="request()->routeIs('register')">
{{ __('Register') }}
</x-nav-link>
@auth()
<x-nav-link href="{{ route('users') }}" :active="request()->routeIs('users')">
{{ __('Users') }}
</x-nav-link>
@endauth
<x-nav-link href="{{ route('docs') }}" :active="request()->routeIs('docs')">
{{ __('Documentation') }}
</x-nav-link>
@auth()
<form method="POST" action="{{ route('logout') }}">
@csrf
<button class="w-20 h-10 rounded-lg bg-gray-800 text-white hover:bg-blue-700 mt-3"
type="submit">Logout</button>
</form>
@endauth
</div>
</div>
<!-- Hamburger -->
<div class="-mr-2 flex items-center sm:hidden">
<button @click="data.open = ! data.open"
class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path v-bind:class="{'hidden': data.open, 'inline-flex': ! data.open }"
stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 6h16M4 12h16M4 18h16" />
<path v-bind:class="{'hidden': ! data.open, 'inline-flex': data.open }"
stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div v-bind:class="{'block': data.open, 'hidden': ! data.open }" class="sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link href="{{ route('home') }}" :active="request()->routeIs('home')">
{{ __('Home') }}
</x-responsive-nav-link>
<x-responsive-nav-link href="{{ route('docs') }}" :active="request()->routeIs('docs')">
{{ __('Documentation') }}
</x-responsive-nav-link>
</div>
</div>
</nav>
use App\Http\Controllers\UsersController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\AdminDashboardController;
use App\Http\Controllers\SuperAdminDashboardController;
/*
|--------------------------------------------------------------------------
Web Routes
Here is where you can register web routes for your application. These
routes are loaded by the RouteServiceProvider within a group which
contains the "web" middleware group. Now create something great!
*/
Route::middleware(['splade'])->group(function () {
Route::get('/', fn() => view('home'))->name('home');
Route::get('/docs', fn() => view('docs'))->name('docs');
Route::get('/login', fn() => view('auth.login'))->name('login');
Route::get('/register', fn() => view('auth.register'))->name('register');
Route::get('/forgot-password', fn() => view('auth.forgot-password'))->name(
'forgot-password'
);
Route::get('/reset-password', fn() => view('auth.reset-password'))->name(
'reset-password'
);
Route::middleware('auth')->group(function () {
Route::resource('users', UsersController::class);
});
// Route::get('/user', [UsersController::class, 'index'])
// ->name('users')
// ->middleware('auth');
//
// Route::get('/user/create', [UsersController::class, 'create'])
// ->name('users.create')
// ->middleware('auth');
Route::middleware(['auth', 'userType'])->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index'])->name(
'user.dashboard'
);
});
Route::middleware(['auth', 'userType'])->group(function () {
Route::get('/admin/dashboard', [
AdminDashboardController::class,
'index',
])->name('admin.dashboard');
});
Route::middleware(['auth', 'userType'])->group(function () {
Route::get('/superadmin/dashboard', [
SuperAdminDashboardController::class,
'index',
])->name('superadmin.dashboard');
});
// Registers routes to support the interactive components...
Route::spladeWithVueBridge();
// Registers routes to support password confirmation in Form and Link components...
Route::spladePasswordConfirmation();
// Registers routes to support Table Bulk Actions and Exports...
Route::spladeTable();
// Registers routes to support async File Uploads with Filepond...
Route::spladeUploads();
});
my controller<?php
namespace App\Http\Controllers;
use App\Actions\Fortify\CreateNewUser;
use App\Http\Requests\UserStoreRequest;
use Illuminate\Http\Request;
use App\Models\User;
use ProtoneMedia\Splade\SpladeTable;
class UsersController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$users = User::paginate();
return view('users.index', [
'users' => SpladeTable::for($users)
->column('name', sortable: true)
->column('email', sortable: true)
->column('id', sortable: true)
->column('type')
->column('created_at', sortable: true),
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('users.create');
}
/**
* Store a newly created resource in storage.
*/
public function store(UserStoreRequest $request)
{
$request->validated();
Create::User($request->all());
return redirect()->route('users.index');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}