Skip to content

Commit

Permalink
Put jobs routes in group again
Browse files Browse the repository at this point in the history
Two approaches of jobs routes still share the same call of middleware.
Put them together to share the same middleware.
  • Loading branch information
sacren committed Dec 14, 2024
1 parent 83b6f9e commit e76cf4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
return View::make('welcome');
});

Route::middleware(['auth', 'verified'])
->resource('jobs', JobController::class)
->only(['index', 'create', 'store', 'show', 'edit', 'destroy']);
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('jobs', JobController::class)->only([
'index', 'create', 'store', 'show', 'edit', 'destroy'
]);

Route::patch('/jobs/{job}', [JobController::class, 'update'])
->middleware(['auth', 'verified'])
->name('jobs.update');
// Explicit PATCH route for certainty, overriding the default resource behavior
Route::patch('/jobs/{job}', [JobController::class, 'update'])->name('jobs.update');
});

Route::get('/about', function () {
return View::make('about');
Expand Down

0 comments on commit e76cf4e

Please sign in to comment.