diff --git a/app/Http/Controllers/SchoolController.php b/app/Http/Controllers/SchoolController.php index a09e4f7..a084107 100644 --- a/app/Http/Controllers/SchoolController.php +++ b/app/Http/Controllers/SchoolController.php @@ -97,8 +97,7 @@ class SchoolController extends Controller 'zip' => request('zip'), ]); - // TODO Handle redirect after updating school more elegantly - return redirect('/schools/'.$school->id); + return redirect()->route('schools.show', $school->id)->with('success', 'School details updated'); } public function my_school() diff --git a/routes/user.php b/routes/user.php index 7bbe0c0..3974d1a 100644 --- a/routes/user.php +++ b/routes/user.php @@ -42,6 +42,6 @@ Route::middleware(['auth', 'verified'])->controller(SchoolController::class)->gr Route::get('/schools/create', 'create'); Route::post('/schools', 'store'); Route::get('/schools/{school}/edit', 'edit'); - Route::get('/schools/{school}', 'show'); + Route::get('/schools/{school}', 'show')->name('schools.show'); Route::patch('/schools/{school}', 'update'); });