+ @if (session('status') === 'role-created')
+
+ {{ __('Role created successfully.') }}
+
+ @endif
+
diff --git a/routes/web.php b/routes/web.php
index 36af0fe..5ae45dd 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -14,6 +14,8 @@ Route::get('/dashboard', function () {
Route::middleware('auth')->group(function () {
Route::get('/role', [RoleController::class, 'index'])->name('role.index');
+ Route::get('/role/create', [RoleController::class, 'create'])->name('role.create');
+ Route::post('/role', [RoleController::class, 'store'])->name('role.store');
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
diff --git a/tests/Feature/RoleIndexTest.php b/tests/Feature/RoleIndexTest.php
index 8381cd4..2458028 100644
--- a/tests/Feature/RoleIndexTest.php
+++ b/tests/Feature/RoleIndexTest.php
@@ -21,3 +21,18 @@ test('authenticated users can view the role index', function () {
->assertSee('Admin')
->assertSee('Editor');
});
+
+test('authenticated users can create a role', function () {
+ $response = $this
+ ->actingAs(User::factory()->create())
+ ->post('/role', [
+ 'name' => 'Manager',
+ ]);
+
+ $response
+ ->assertRedirect('/role');
+
+ $this->assertDatabaseHas('roles', [
+ 'name' => 'Manager',
+ ]);
+});