-
- @if($event->auditions()->count() == 0)
-
- @endif
+
+ @foreach($events as $event)
+ @php($currentRenameModalName = "showRenameModal_".$event->id)
+ @include('admin.event.index-rename-event-modal')
+ @endforeach
+
+
+
+ @foreach($events as $event)
+
+
+
+ {{ $event->name }}
+
+
+ {{ $event->auditions()->count() }} Auditions
+
+
+
+ @if($event->auditions()->count() == 0)
+
+ @endif
+
+
+ @endforeach
+
+
+
+
+
+
-
- @endforeach
-
-
-
-
-
-
-
-
- Create
-
-
-
-
-
+
+ Create
+
+
+
+
+
+
diff --git a/routes/admin.php b/routes/admin.php
index 2690b80..642c40f 100644
--- a/routes/admin.php
+++ b/routes/admin.php
@@ -88,6 +88,7 @@ Route::middleware(['auth', 'verified', CheckIfAdmin::class])->prefix('admin/')->
Route::get('/', 'index')->name('admin.events.index');
Route::post('/', 'store')->name('admin.events.store');
Route::delete('/{event}', 'destroy')->name('admin.events.destroy');
+ Route::patch('/{event}', 'update')->name('admin.events.update');
});
// Admin Rooms Routes
diff --git a/tests/Feature/app/Http/Controllers/Admin/EventControllerTest.php b/tests/Feature/app/Http/Controllers/Admin/EventControllerTest.php
index c639190..c9d02f3 100644
--- a/tests/Feature/app/Http/Controllers/Admin/EventControllerTest.php
+++ b/tests/Feature/app/Http/Controllers/Admin/EventControllerTest.php
@@ -79,6 +79,26 @@ describe('EventController::Store', function () {
});
});
+describe('EventController::Update', function () {
+ beforeEach(function () {
+ $this->event = Event::factory()->create();
+ });
+ it('denies access to a non-admin user', function () {
+ $this->patch(route('admin.events.update', $this->event), [])->assertRedirect(route('home'));
+ actAsNormal();
+ $this->patch(route('admin.events.update', $this->event), [])->assertRedirect(route('dashboard'));
+ actAsTab();
+ $this->patch(route('admin.events.update', $this->event), [])->assertRedirect(route('dashboard'));
+ });
+ it('updates an event', function () {
+ actAsAdmin();
+ $this->patch(route('admin.events.update', $this->event), ['name' => 'Renamed Test Event']);
+ $this->assertDatabaseHas('events', [
+ 'name' => 'Renamed Test Event',
+ ]);
+ });
+});
+
describe('EventController::Destroy', function () {
it('denies access to a non-admin user', function () {
$event = \App\Models\Event::factory()->create();