diff --git a/app/Livewire/Forms/VenueForm.php b/app/Livewire/Forms/VenueForm.php
new file mode 100644
index 00000000..6e5090af
--- /dev/null
+++ b/app/Livewire/Forms/VenueForm.php
@@ -0,0 +1,41 @@
+ 'required|string',
+ ];
+ }
+
+ public function setVenueModel(Venue $venueModel): void
+ {
+ $this->venueModel = $venueModel;
+
+ $this->name = $this->venueModel->name;
+ }
+
+ public function store(): void
+ {
+ $this->venueModel->create($this->validate());
+
+ $this->reset();
+ }
+
+ public function update(): void
+ {
+ $this->venueModel->update($this->validate());
+
+ $this->reset();
+ }
+}
diff --git a/app/Livewire/Venues/Create.php b/app/Livewire/Venues/Create.php
new file mode 100644
index 00000000..7a4cf222
--- /dev/null
+++ b/app/Livewire/Venues/Create.php
@@ -0,0 +1,32 @@
+form->setVenueModel($venue);
+ }
+
+ public function save(): void
+ {
+ $this->form->store();
+
+ $this->redirectRoute('venues.index', navigate: true);
+ }
+
+ #[Layout('layouts.app')]
+ public function render(): View
+ {
+ return view('livewire.venue.create');
+ }
+}
diff --git a/app/Livewire/Venues/Edit.php b/app/Livewire/Venues/Edit.php
new file mode 100644
index 00000000..ed3886f1
--- /dev/null
+++ b/app/Livewire/Venues/Edit.php
@@ -0,0 +1,32 @@
+form->setVenueModel($venue);
+ }
+
+ public function save(): void
+ {
+ $this->form->update();
+
+ $this->redirectRoute('venues.index', navigate: true);
+ }
+
+ #[Layout('layouts.app')]
+ public function render(): View
+ {
+ return view('livewire.venue.edit');
+ }
+}
diff --git a/app/Livewire/Venues/Index.php b/app/Livewire/Venues/Index.php
new file mode 100644
index 00000000..344afdd9
--- /dev/null
+++ b/app/Livewire/Venues/Index.php
@@ -0,0 +1,30 @@
+with('i', $this->getPage() * $venues->perPage());
+ }
+
+ public function delete(Venue $venue): void
+ {
+ $venue->delete();
+
+ $this->redirectRoute('venues.index', navigate: true);
+ }
+}
diff --git a/app/Livewire/Venues/Show.php b/app/Livewire/Venues/Show.php
new file mode 100644
index 00000000..092fefc8
--- /dev/null
+++ b/app/Livewire/Venues/Show.php
@@ -0,0 +1,25 @@
+form->setVenueModel($venue);
+ }
+
+ #[Layout('layouts.app')]
+ public function render(): View
+ {
+ return view('livewire.venue.show', ['venue' => $this->form->venueModel]);
+ }
+}
diff --git a/resources/views/components/navigation.blade.php b/resources/views/components/navigation.blade.php
index 21080810..7d74389c 100644
--- a/resources/views/components/navigation.blade.php
+++ b/resources/views/components/navigation.blade.php
@@ -19,7 +19,7 @@
Teams
-
+
Venues
diff --git a/resources/views/livewire/venue/create.blade.php b/resources/views/livewire/venue/create.blade.php
new file mode 100644
index 00000000..f56868fb
--- /dev/null
+++ b/resources/views/livewire/venue/create.blade.php
@@ -0,0 +1,12 @@
+Venues
+
+
+ Create a new venue
+
+
+
+
+
diff --git a/resources/views/livewire/venue/edit.blade.php b/resources/views/livewire/venue/edit.blade.php
new file mode 100644
index 00000000..1d313b71
--- /dev/null
+++ b/resources/views/livewire/venue/edit.blade.php
@@ -0,0 +1,13 @@
+Venues
+
+
+ Update the {{ $this->form->venueModel->name }} venue
+
+
+
+
+
diff --git a/resources/views/livewire/venue/form.blade.php b/resources/views/livewire/venue/form.blade.php
new file mode 100644
index 00000000..53ba8bb4
--- /dev/null
+++ b/resources/views/livewire/venue/form.blade.php
@@ -0,0 +1,13 @@
+
+
+
+
+ @error('form.name')
+
+ @enderror
+
+
+
+ Save
+
+
diff --git a/resources/views/livewire/venue/index.blade.php b/resources/views/livewire/venue/index.blade.php
new file mode 100644
index 00000000..ecd3db23
--- /dev/null
+++ b/resources/views/livewire/venue/index.blade.php
@@ -0,0 +1,25 @@
+Venues
+
+
+
A list of all the venues in the system
+
+
+ @foreach ($venues as $venue)
+
+ {{ $venue->name }}
+
+
+
+
+ Are you sure you want to delete venue {{ $venue->name }}?"
+
+
+
+ @endforeach
+
+
+
+ {!! $venues->withQueryString()->links() !!}
+
+
+
diff --git a/resources/views/livewire/venue/show.blade.php b/resources/views/livewire/venue/show.blade.php
new file mode 100644
index 00000000..d9b2cd8e
--- /dev/null
+++ b/resources/views/livewire/venue/show.blade.php
@@ -0,0 +1,10 @@
+Venues
+
+
+ Details of the {{ $venue->name }} venue
+
+
+ {{ $venue->name }}
+
+
+
diff --git a/routes/web.php b/routes/web.php
index 290dcbcb..2b565f31 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -16,9 +16,12 @@
Route::get('/seasons/update/{season}', \App\Livewire\Seasons\Edit::class)->name('seasons.edit');
Route::get('/competitions', \App\Livewire\Competitions\Index::class)->name('competitions.index');
- Route::get('/competitions/create', \App\Livewire\Competitions\Create::class)->name('competitions.create');
- Route::get('/competitions/show/{competition}', \App\Livewire\Competitions\Show::class)->name('competitions.show');
- Route::get('/competitions/update/{competition}', \App\Livewire\Competitions\Edit::class)->name('competitions.edit');
+ Route::get('/competitions/create',
+ \App\Livewire\Competitions\Create::class)->name('competitions.create');
+ Route::get('/competitions/show/{competition}',
+ \App\Livewire\Competitions\Show::class)->name('competitions.show');
+ Route::get('/competitions/update/{competition}',
+ \App\Livewire\Competitions\Edit::class)->name('competitions.edit');
Route::get('/divisions', \App\Livewire\Divisions\Index::class)->name('divisions.index');
Route::get('/divisions/create', \App\Livewire\Divisions\Create::class)->name('divisions.create');
@@ -37,7 +40,10 @@
Route::get('/teams/show/{team}', \App\Livewire\Teams\Show::class)->name('teams.show');
Route::get('/teams/update/{team}', \App\Livewire\Teams\Edit::class)->name('teams.edit');
- Route::view('venues', 'venues')->name('venues');
+ Route::get('/venues', \App\Livewire\Venues\Index::class)->name('venues.index');
+ Route::get('/venues/create', \App\Livewire\Venues\Create::class)->name('venues.create');
+ Route::get('/venues/show/{venue}', \App\Livewire\Venues\Show::class)->name('venues.show');
+ Route::get('/venues/update/{venue}', \App\Livewire\Venues\Edit::class)->name('venues.edit');
});
Route::view('appointments', 'appointments')->name('appointments');