change workshop table to events

This commit is contained in:
2024-05-07 15:00:32 +10:00
parent 391b17c1e7
commit 8f8d12065d
16 changed files with 244 additions and 205 deletions

View File

@@ -2,11 +2,11 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Workshop; use App\Models\Event;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class WorkshopController extends Controller class EventController extends Controller
{ {
/** /**
* Display a listing of the resource. * Display a listing of the resource.
@@ -16,7 +16,7 @@ class WorkshopController extends Controller
$homeView = true; $homeView = true;
$search = $request->get('search', ''); $search = $request->get('search', '');
$query = Workshop::query(); $query = Event::query();
if(!auth()->user()?->admin) { if(!auth()->user()?->admin) {
$query = $query->where('status', '!=', 'draft'); $query = $query->where('status', '!=', 'draft');
@@ -83,9 +83,9 @@ class WorkshopController extends Controller
$query = $query->orderBy('starts_at', 'asc'); $query = $query->orderBy('starts_at', 'asc');
} }
$workshops = $query->paginate(12); $events = $query->paginate(12);
return view('workshop.index', [ return view('event.index', [
'workshops' => $workshops, 'events' => $events,
'search' => $search, 'search' => $search,
]); ]);
} }
@@ -95,17 +95,17 @@ class WorkshopController extends Controller
*/ */
public function admin_index(Request $request) public function admin_index(Request $request)
{ {
$query = Workshop::query(); $query = Event::query();
if($request->has('search')) { if($request->has('search')) {
$query->where('title', 'like', '%' . $request->search . '%'); $query->where('title', 'like', '%' . $request->search . '%');
$query->orWhere('content', 'like', '%' . $request->search . '%'); $query->orWhere('content', 'like', '%' . $request->search . '%');
} }
$workshops = $query->orderBy('starts_at', 'desc')->paginate(12)->onEachSide(1); $events = $query->orderBy('starts_at', 'desc')->paginate(12)->onEachSide(1);
return view('admin.workshop.index', [ return view('admin.event.index', [
'workshops' => $workshops 'events' => $events
]); ]);
} }
@@ -114,7 +114,7 @@ class WorkshopController extends Controller
*/ */
public function admin_create() public function admin_create()
{ {
return view('admin.workshop.edit'); return view('admin.event.edit');
} }
/** /**
@@ -146,46 +146,46 @@ class WorkshopController extends Controller
'registration_data.required_unless' => __('validation.custom_messages.registration_data_required_unless'), 'registration_data.required_unless' => __('validation.custom_messages.registration_data_required_unless'),
]); ]);
$workshopData = $request->all(); $eventData = $request->all();
$workshopData['user_id'] = auth()->user()->id; $eventData['user_id'] = auth()->user()->id;
if($workshopData['status'] === 'open' && Carbon::parse($workshopData['starts_at'])->lt(Carbon::now())) { if($eventData['status'] === 'open' && Carbon::parse($eventData['starts_at'])->lt(Carbon::now())) {
$workshopData['status'] = 'closed'; $eventData['status'] = 'closed';
} }
$workshop = Workshop::create($workshopData); $event = Event::create($eventData);
$workshop->updateFiles($request->input('files')); $event->updateFiles($request->input('files'));
session()->flash('message', 'Workshop has been created'); session()->flash('message', 'Event has been created');
session()->flash('message-title', 'Workshop created'); session()->flash('message-title', 'Event created');
session()->flash('message-type', 'success'); session()->flash('message-type', 'success');
return redirect()->route('admin.workshop.index'); return redirect()->route('admin.event.index');
} }
/** /**
* Display the specified resource. * Display the specified resource.
*/ */
public function show(Workshop $workshop) public function show(Event $event)
{ {
if(!auth()->user()?->admin && $workshop->status == 'draft') { if(!auth()->user()?->admin && $event->status == 'draft') {
abort(404); abort(404);
} }
return view('workshop.show', ['workshop' => $workshop]); return view('event.show', ['event' => $event]);
} }
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
*/ */
public function admin_edit(Workshop $workshop) public function admin_edit(Event $event)
{ {
return view('admin.workshop.edit', ['workshop' => $workshop]); return view('admin.event.edit', ['event' => $event]);
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
*/ */
public function admin_update(Request $request, Workshop $workshop) public function admin_update(Request $request, Event $event)
{ {
$request->validate([ $request->validate([
'title' => 'required', 'title' => 'required',
@@ -211,51 +211,51 @@ class WorkshopController extends Controller
'registration_data.required_unless' => __('validation.custom_messages.registration_data_required_unless'), 'registration_data.required_unless' => __('validation.custom_messages.registration_data_required_unless'),
]); ]);
$workshopData = $request->all(); $eventData = $request->all();
if($workshopData['status'] === 'open' && Carbon::parse($workshopData['starts_at'])->lt(Carbon::now())) { if($eventData['status'] === 'open' && Carbon::parse($eventData['starts_at'])->lt(Carbon::now())) {
$workshopData['status'] = 'closed'; $eventData['status'] = 'closed';
} }
$workshop->update($workshopData); $event->update($eventData);
$workshop->updateFiles($request->input('files')); $event->updateFiles($request->input('files'));
session()->flash('message', 'Workshop has been updated'); session()->flash('message', 'Event has been updated');
session()->flash('message-title', 'Workshop updated'); session()->flash('message-title', 'Event updated');
session()->flash('message-type', 'success'); session()->flash('message-type', 'success');
return redirect()->route('admin.workshop.index'); return redirect()->route('admin.event.index');
} }
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
*/ */
public function admin_destroy(Workshop $workshop) public function admin_destroy(Event $event)
{ {
$workshop->delete(); $event->delete();
session()->flash('message', 'Workshop has been deleted'); session()->flash('message', 'Event has been deleted');
session()->flash('message-title', 'Workshop deleted'); session()->flash('message-title', 'Event deleted');
session()->flash('message-type', 'danger'); session()->flash('message-type', 'danger');
return redirect()->route('admin.workshop.index'); return redirect()->route('admin.event.index');
} }
/** /**
* Duplicate the specified resource. * Duplicate the specified resource.
*/ */
public function admin_duplicate(Workshop $workshop) public function admin_duplicate(Event $event)
{ {
$newWorkshop = $workshop->replicate(); $newWorkshop = $event->replicate();
$newWorkshop->title = $newWorkshop->title . ' (copy)'; $newWorkshop->title = $newWorkshop->title . ' (copy)';
$newWorkshop->status = 'draft'; $newWorkshop->status = 'draft';
$newWorkshop->save(); $newWorkshop->save();
foreach($workshop->files as $file) { foreach($event->files as $file) {
$newWorkshop->files()->attach($file->name); $newWorkshop->files()->attach($file->name);
} }
session()->flash('message', 'Workshop has been duplicated'); session()->flash('message', 'Event has been duplicated');
session()->flash('message-title', 'Workshop duplicated'); session()->flash('message-title', 'Event duplicated');
session()->flash('message-type', 'success'); session()->flash('message-type', 'success');
return redirect()->route('admin.workshop.edit', $newWorkshop); return redirect()->route('admin.event.edit', $newWorkshop);
} }
} }

View File

@@ -3,18 +3,18 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Post; use App\Models\Post;
use App\Models\Workshop; use App\Models\Event;
class HomeController extends Controller class HomeController extends Controller
{ {
public function index() public function index()
{ {
$posts = Post::query()->orderBy('created_at', 'desc')->limit(4)->get(); $posts = Post::query()->orderBy('created_at', 'desc')->limit(4)->get();
$workshops = Workshop::query()->where('starts_at', '>', now())->where('status', '!=', 'private')->orderBy('starts_at', 'asc')->limit(4)->get(); $events = Event::query()->where('starts_at', '>', now())->where('status', '!=', 'private')->orderBy('starts_at', 'asc')->limit(4)->get();
return view('home', [ return view('home', [
'posts' => $posts, 'posts' => $posts,
'workshops' => $workshops, 'events' => $events,
]); ]);
} }
} }

View File

@@ -7,7 +7,7 @@ use App\Traits\Slug;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Workshop extends Model class Event extends Model
{ {
use HasFactory, Slug, HasFiles; use HasFactory, Slug, HasFiles;

View File

@@ -3,13 +3,13 @@
namespace Database\Factories; namespace Database\Factories;
use App\Models\Location; use App\Models\Location;
use App\Models\Workshop; use App\Models\Event;
use DateInterval; use DateInterval;
use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\Factory;
class WorkshopFactory extends Factory class WorkshopFactory extends Factory
{ {
protected $model = Workshop::class; protected $model = Event::class;
public function definition(): array public function definition(): array
{ {

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::rename('workshops', 'events');
Schema::table('tickets', function (Blueprint $table) {
$table->dropForeign(['workshop_id']);
$table->renameColumn('workshop_id', 'event_id');
$table->foreign('event_id')->references('id')->on('events');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::rename('events', 'workshops');
Schema::table('tickets', function (Blueprint $table) {
$table->dropForeign(['event_id']);
$table->renameColumn('event_id', 'workshop_id');
$table->foreign('workshops_id')->references('id')->on('workshops');
});
}
};

View File

@@ -7,7 +7,7 @@ use App\Models\Media;
use App\Models\Post; use App\Models\Post;
use App\Models\User; use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents; // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Workshop; use App\Models\Event;
use Database\Factories\LocationFactory; use Database\Factories\LocationFactory;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;

View File

@@ -1,33 +1,33 @@
@php @php
$workshopContent = isset($workshop) ? $workshop->content : ''; $eventContent = isset($event) ? $event->content : '';
@endphp @endphp
<x-layout> <x-layout>
<x-mast backRoute="admin.workshop.index" backTitle="Workshops">{{ isset($workshop) ? 'Edit' : 'Create' }} Workshop</x-mast> <x-mast backRoute="admin.event.index" backTitle="Workshops">{{ isset($event) ? 'Edit' : 'Create' }} Workshop</x-mast>
<x-container class="mt-4"> <x-container class="mt-4">
<form x-data="{type:'physical',registration:'{{old('registration', $workshop->registration ?? 'none')}}'}" method="POST" action="{{ route('admin.workshop.' . (isset($workshop) ? 'update' : 'store'), $workshop ?? []) }}"> <form x-data="{type:'physical',registration:'{{old('registration', $event->registration ?? 'none')}}'}" method="POST" action="{{ route('admin.event.' . (isset($event) ? 'update' : 'store'), $event ?? []) }}">
@isset($workshop) @isset($event)
@method('PUT') @method('PUT')
@endisset @endisset
@csrf @csrf
<div class="mb-4"> <div class="mb-4">
<x-ui.input label="Title" name="title" value="{!! isset($workshop) ? $workshop->title : '' !!}" /> <x-ui.input label="Title" name="title" value="{!! isset($event) ? $event->title : '' !!}" />
</div> </div>
<div class="mb-4"> <div class="mb-4">
<x-ui.media label="Image" name="hero_media_name" value="{{ $workshop->hero_media_name ?? '' }}" allow_uploads="true" /> <x-ui.media label="Image" name="hero_media_name" value="{{ $event->hero_media_name ?? '' }}" allow_uploads="true" />
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
<div class="flex-1"> <div class="flex-1">
<x-ui.select label="Type" name="type" x-model="type"> <x-ui.select label="Type" name="type" x-model="type">
<option value="physical" {{ ($workshop->location_id ?? '') !== '' || !isset($workshop) ? 'selected' : '' }}>Physical</option> <option value="physical" {{ ($event->location_id ?? '') !== '' || !isset($event) ? 'selected' : '' }}>Physical</option>
<option value="online" {{ ($workshop->location_id ?? '') === null ? 'selected' : '' }}>Online</option> <option value="online" {{ ($event->location_id ?? '') === null ? 'selected' : '' }}>Online</option>
</x-ui.select> </x-ui.select>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<span x-show="type==='physical'"> <span x-show="type==='physical'">
<x-ui.select label="Location" name="location_id"> <x-ui.select label="Location" name="location_id">
@foreach(\App\Models\Location::orderByRaw("name = 'Online' DESC, name ASC")->get() as $location) @foreach(\App\Models\Location::orderByRaw("name = 'Online' DESC, name ASC")->get() as $location)
<option value="{{ $location->id }}" {{ ($workshop->location_id ?? '') === $location->id ? 'selected' : '' }}>{{ $location->name }}</option> <option value="{{ $location->id }}" {{ ($event->location_id ?? '') === $location->id ? 'selected' : '' }}>{{ $location->name }}</option>
@endforeach @endforeach
</x-ui.select> </x-ui.select>
</span> </span>
@@ -35,26 +35,26 @@
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
<div class="flex-1"> <div class="flex-1">
<x-ui.input type="datetime-local" label="Start Date" name="starts_at" value="{{ \App\Helpers::timestampNoSeconds($workshop->starts_at ?? '') }}" onchange="updatedStartsAt()"/> <x-ui.input type="datetime-local" label="Start Date" name="starts_at" value="{{ \App\Helpers::timestampNoSeconds($event->starts_at ?? '') }}" onchange="updatedStartsAt()"/>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<x-ui.input type="datetime-local" label="End Date" name="ends_at" value="{{ \App\Helpers::timestampNoSeconds($workshop->ends_at ?? '') }}" /> <x-ui.input type="datetime-local" label="End Date" name="ends_at" value="{{ \App\Helpers::timestampNoSeconds($event->ends_at ?? '') }}" />
</div> </div>
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
<div class="flex-1"> <div class="flex-1">
<x-ui.select label="Status" name="status"> <x-ui.select label="Status" name="status">
<option value="draft" {{ ($workshop->status ?? '') === 'draft' ? 'selected' : '' }}>Draft</option> <option value="draft" {{ ($event->status ?? '') === 'draft' ? 'selected' : '' }}>Draft</option>
<option value="open" {{ ($workshop->status ?? '') === 'open' ? 'selected' : '' }}>Open</option> <option value="open" {{ ($event->status ?? '') === 'open' ? 'selected' : '' }}>Open</option>
<option value="private" {{ ($workshop->status ?? '') === 'private' ? 'selected' : '' }}>Private</option> <option value="private" {{ ($event->status ?? '') === 'private' ? 'selected' : '' }}>Private</option>
<option value="full" {{ ($workshop->status ?? '') === 'full' ? 'selected' : '' }}>Full</option> <option value="full" {{ ($event->status ?? '') === 'full' ? 'selected' : '' }}>Full</option>
<option value="scheduled" {{ ($workshop->status ?? '') === 'scheduled' ? 'selected' : '' }}>Scheduled</option> <option value="scheduled" {{ ($event->status ?? '') === 'scheduled' ? 'selected' : '' }}>Scheduled</option>
<option value="closed" {{ ($workshop->status ?? '') === 'closed' ? 'selected' : '' }}>Closed</option> <option value="closed" {{ ($event->status ?? '') === 'closed' ? 'selected' : '' }}>Closed</option>
<option value="cancelled" {{ ($workshop->status ?? '') === 'cancelled' ? 'selected' : '' }}>Cancelled</option> <option value="cancelled" {{ ($event->status ?? '') === 'cancelled' ? 'selected' : '' }}>Cancelled</option>
</x-ui.select> </x-ui.select>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<x-ui.input type="datetime-local" label="Publish Date" name="publish_at" value="{{ \App\Helpers::timestampNoSeconds($workshop->publish_at ?? '') }}" onchange="updatedPublishAt()" /> <x-ui.input type="datetime-local" label="Publish Date" name="publish_at" value="{{ \App\Helpers::timestampNoSeconds($event->publish_at ?? '') }}" onchange="updatedPublishAt()" />
</div> </div>
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
@@ -62,44 +62,44 @@
&nbsp; &nbsp;
</div> </div>
<div class="flex-1"> <div class="flex-1">
<x-ui.input type="datetime-local" label="Closes Date" name="closes_at" value="{{ \App\Helpers::timestampNoSeconds($workshop->closes_at ?? '') }}" /> <x-ui.input type="datetime-local" label="Closes Date" name="closes_at" value="{{ \App\Helpers::timestampNoSeconds($event->closes_at ?? '') }}" />
</div> </div>
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
<div class="flex-1"> <div class="flex-1">
<x-ui.input label="Price" name="price" info="Leave blank to hide from public. Also supports Free, TBD or TBC" value="{{ $workshop->price ?? '' }}" /> <x-ui.input label="Price" name="price" info="Leave blank to hide from public. Also supports Free, TBD or TBC" value="{{ $event->price ?? '' }}" />
</div> </div>
<div class="flex-1"> <div class="flex-1">
<x-ui.input label="Ages" name="ages" info="Leave blank to hide from public" value="{{ $workshop->ages ?? '8+' }}" /> <x-ui.input label="Ages" name="ages" info="Leave blank to hide from public" value="{{ $event->ages ?? '8+' }}" />
</div> </div>
</div> </div>
<div class="flex flex-col sm:flex-row sm:gap-8"> <div class="flex flex-col sm:flex-row sm:gap-8">
<div class="flex-1"> <div class="flex-1">
<x-ui.select label="Registration" name="registration" x-model="registration" onchange="document.getElementsByName('registration_data').forEach((e)=>e.value='')"> <x-ui.select label="Registration" name="registration" x-model="registration" onchange="document.getElementsByName('registration_data').forEach((e)=>e.value='')">
<option value="none" {{ (old('registration', $workshop->registration ?? '')) === 'none' ? 'selected' : '' }}>None</option> <option value="none" {{ (old('registration', $event->registration ?? '')) === 'none' ? 'selected' : '' }}>None</option>
<option value="link" {{ (old('registration', $workshop->registration ?? '')) === 'link' ? 'selected' : '' }}>External Link</option> <option value="link" {{ (old('registration', $event->registration ?? '')) === 'link' ? 'selected' : '' }}>External Link</option>
<option value="email" {{ (old('registration', $workshop->registration ?? '')) === 'email' ? 'selected' : '' }}>External Email</option> <option value="email" {{ (old('registration', $event->registration ?? '')) === 'email' ? 'selected' : '' }}>External Email</option>
<option value="message" {{ (old('registration', $workshop->registration ?? '')) === 'message' ? 'selected' : '' }}>Custom Message</option> <option value="message" {{ (old('registration', $event->registration ?? '')) === 'message' ? 'selected' : '' }}>Custom Message</option>
</x-ui.select> </x-ui.select>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<span x-show="registration==='link'"> <span x-show="registration==='link'">
<x-ui.input label="Registration URL" name="registration_url" id="registration_url" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" /> <x-ui.input label="Registration URL" name="registration_url" id="registration_url" value="{{ $event->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<span x-show="registration==='email'"> <span x-show="registration==='email'">
<x-ui.input label="Registration Email" name="registration_email" id="registration_email" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" /> <x-ui.input label="Registration Email" name="registration_email" id="registration_email" value="{{ $event->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<span x-show="registration==='message'"> <span x-show="registration==='message'">
<x-ui.input label="Registration Message" name="registration_message" id="registration_message" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" /> <x-ui.input label="Registration Message" name="registration_message" id="registration_message" value="{{ $event->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<input type="hidden" name="registration_data" id="registration_data" value="{{ $workshop->registration_data ?? '' }}"> <input type="hidden" name="registration_data" id="registration_data" value="{{ $event->registration_data ?? '' }}">
</div> </div>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<x-ui.editor <x-ui.editor
label="Content" label="Content"
name="content" name="content"
value="{!! $workshopContent !!}" value="{!! $eventContent !!}"
></x-ui.editor> ></x-ui.editor>
</div> </div>
<div class="mb-4"> <div class="mb-4">
@@ -107,14 +107,14 @@
label="Files" label="Files"
name="files" name="files"
editor="true" editor="true"
value="{!! isset($workshop) ? $workshop->files()->orderBy('name')->get() : '' !!}" value="{!! isset($event) ? $event->files()->orderBy('name')->get() : '' !!}"
></x-ui.filelist> ></x-ui.filelist>
</div> </div>
<div class="flex justify-end gap-4 mt-8"> <div class="flex justify-end gap-4 mt-8">
@isset($workshop) @isset($event)
<x-ui.button type="button" color="danger" x-data x-on:click.prevent="SM.confirmDelete('{{ csrf_token() }}', 'Delete workshop?', 'Are you sure you want to delete this workshop? This action cannot be undone', '{{ route('admin.workshop.destroy', $workshop) }}')">Delete</x-ui.button> <x-ui.button type="button" color="danger" x-data x-on:click.prevent="SM.confirmDelete('{{ csrf_token() }}', 'Delete workshop?', 'Are you sure you want to delete this workshop? This action cannot be undone', '{{ route('admin.event.destroy', $event) }}')">Delete</x-ui.button>
@endisset @endisset
<x-ui.button type="submit">{{ isset($workshop) ? 'Save' : 'Create' }}</x-ui.button> <x-ui.button type="submit">{{ isset($event) ? 'Save' : 'Create' }}</x-ui.button>
</div> </div>
</form> </form>
</x-container> </x-container>

View File

@@ -4,14 +4,14 @@
<x-container> <x-container>
<div class="flex my-4 items-center"> <div class="flex my-4 items-center">
<div class="flex-1"> <div class="flex-1">
<x-ui.button type="link" href="{{ route('admin.workshop.create') }}">Create</x-ui.button> <x-ui.button type="link" href="{{ route('admin.event.create') }}">Create</x-ui.button>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<x-ui.search name="search" label="Search" /> <x-ui.search name="search" label="Search" />
</div> </div>
</div> </div>
@if($workshops->isEmpty()) @if($events->isEmpty())
<x-none-found item="workshops" search="{{ request()->get('search') }}" /> <x-none-found item="workshops" search="{{ request()->get('search') }}" />
@else @else
<x-ui.table> <x-ui.table>
@@ -23,24 +23,24 @@
<th>Action</th> <th>Action</th>
</x-slot:header> </x-slot:header>
<x-slot:body> <x-slot:body>
@foreach ($workshops as $workshop) @foreach ($events as $event)
<tr> <tr>
<td class="flex items-center"> <td class="flex items-center">
<img src="{{ $workshop->hero->thumbnail }}" class="max-h-12 max-w-12 -ml-2 -my-3 mr-3 inline rounded" alt="{{ $workshop->hero->title }}" /> <img src="{{ $event->hero->thumbnail }}" class="max-h-12 max-w-12 -ml-2 -my-3 mr-3 inline rounded" alt="{{ $event->hero->title }}" />
<div> <div>
<div class="whitespace-normal">{{ $workshop->title }}</div> <div class="whitespace-normal">{{ $event->title }}</div>
<div class="lg:hidden text-xs text-gray-500">{{ $workshop->location->name }} ({{ ucwords($workshop->status) }})</div> <div class="lg:hidden text-xs text-gray-500">{{ $event->location->name }} ({{ ucwords($event->status) }})</div>
<div class="md:hidden text-xs text-gray-500">{{ \Carbon\Carbon::parse($workshop->starts_at)->format('j/m/Y g:i a') }}</div> <div class="md:hidden text-xs text-gray-500">{{ \Carbon\Carbon::parse($event->starts_at)->format('j/m/Y g:i a') }}</div>
</div> </div>
</td> </td>
<td class="hidden lg:table-cell">{{ ucwords($workshop->status) }}</td> <td class="hidden lg:table-cell">{{ ucwords($event->status) }}</td>
<td class="hidden lg:table-cell">{{ $workshop->location->name }}</td> <td class="hidden lg:table-cell">{{ $event->location->name }}</td>
<td class="hidden md:table-cell">{{ \Carbon\Carbon::parse($workshop->starts_at)->format('M j Y, g:i a') }}</td> <td class="hidden md:table-cell">{{ \Carbon\Carbon::parse($event->starts_at)->format('M j Y, g:i a') }}</td>
<td> <td>
<div class="flex justify-center gap-3"> <div class="flex justify-center gap-3">
<a href="{{ route('admin.workshop.edit', $workshop) }}" class="hover:text-primary-color" title="Edit"><i class="fa-solid fa-pen-to-square"></i></a> <a href="{{ route('admin.event.edit', $event) }}" class="hover:text-primary-color" title="Edit"><i class="fa-solid fa-pen-to-square"></i></a>
<a href="{{ route('admin.workshop.duplicate', $workshop) }}" class="hover:text-primary-color" title="Duplicate"><i class="fa-regular fa-copy"></i></a> <a href="{{ route('admin.event.duplicate', $event) }}" class="hover:text-primary-color" title="Duplicate"><i class="fa-regular fa-copy"></i></a>
<a href="#" class="hover:text-red-600" x-data x-on:click.prevent="SM.confirmDelete('{{ csrf_token() }}', 'Delete workshop?', 'Are you sure you want to delete this workshop? This action cannot be undone', '{{ route('admin.workshop.destroy', $workshop) }}')" title="Delete"><i class="fa-solid fa-trash"></i></a> <a href="#" class="hover:text-red-600" x-data x-on:click.prevent="SM.confirmDelete('{{ csrf_token() }}', 'Delete workshop?', 'Are you sure you want to delete this workshop? This action cannot be undone', '{{ route('admin.event.destroy', $event) }}')" title="Delete"><i class="fa-solid fa-trash"></i></a>
</div> </div>
</td> </td>
</tr> </tr>
@@ -48,7 +48,7 @@
</x-slot:body> </x-slot:body>
</x-ui.table> </x-ui.table>
{{ $workshops->appends(request()->query())->links() }} {{ $events->appends(request()->query())->links() }}
@endif @endif
</x-container> </x-container>

View File

@@ -20,7 +20,7 @@
<div class="hidden sm:ml-6 sm:block mr-4"> <div class="hidden sm:ml-6 sm:block mr-4">
<div class="flex space-x-2"> <div class="flex space-x-2">
<a href="{{ route('post.index') }}" class="text-gray-900 hover:text-sky-500 px-3 py-2 text-sm font-medium transition duration-300 ease-in-out transform hover:-translate-y-0.5" aria-current="page">Blog</a> <a href="{{ route('post.index') }}" class="text-gray-900 hover:text-sky-500 px-3 py-2 text-sm font-medium transition duration-300 ease-in-out transform hover:-translate-y-0.5" aria-current="page">Blog</a>
<a href="{{ route('workshop.index') }}" class="text-gray-900 hover:text-sky-500 px-3 py-2 text-sm font-medium transition duration-300 ease-in-out transform hover:-translate-y-0.5">Workshops</a> <a href="{{ route('event.index') }}" class="text-gray-900 hover:text-sky-500 px-3 py-2 text-sm font-medium transition duration-300 ease-in-out transform hover:-translate-y-0.5">Workshops</a>
</div> </div>
</div> </div>
<div class="ml-3"> <div class="ml-3">
@@ -37,7 +37,7 @@
</div> </div>
<div x-show="open" @click.away="open=false" x-cloak class="absolute w-full right-0 sm:right-5 sm:top-9 z-50 sm:mt-2 sm:w-48 origin-top-right sm:rounded-md bg-white py-3 px-2 shadow-lg border-t sm:ring-1 ring-black ring-opacity-25 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1"> <div x-show="open" @click.away="open=false" x-cloak class="absolute w-full right-0 sm:right-5 sm:top-9 z-50 sm:mt-2 sm:w-48 origin-top-right sm:rounded-md bg-white py-3 px-2 shadow-lg border-t sm:ring-1 ring-black ring-opacity-25 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1">
<a href="{{ route('post.index') }}" class="sm:hidden block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-regular fa-newspaper w-4 mr-2"></i>Blog</a> <a href="{{ route('post.index') }}" class="sm:hidden block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-regular fa-newspaper w-4 mr-2"></i>Blog</a>
<a href="{{ route('workshop.index') }}" class="sm:hidden block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-bullhorn w-4 mr-2"></i>Workshops</a> <a href="{{ route('event.index') }}" class="sm:hidden block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-bullhorn w-4 mr-2"></i>Workshops</a>
<div class="sm:hidden border-t border-gray-200 my-2"></div> <div class="sm:hidden border-t border-gray-200 my-2"></div>
@if(auth()->guest()) @if(auth()->guest())
<a href="{{ route('register') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-pen-to-square w-4 mr-2"></i>Register</a> <a href="{{ route('register') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-pen-to-square w-4 mr-2"></i>Register</a>
@@ -49,7 +49,7 @@
<a href="{{ route('admin.media.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-photo-film w-4 mr-2"></i>Media</a> <a href="{{ route('admin.media.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-photo-film w-4 mr-2"></i>Media</a>
<a href="{{ route('admin.post.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-regular fa-newspaper w-4 mr-2"></i>Posts</a> <a href="{{ route('admin.post.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-regular fa-newspaper w-4 mr-2"></i>Posts</a>
<a href="{{ route('admin.user.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-users w-4 mr-2"></i>Users</a> <a href="{{ route('admin.user.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-users w-4 mr-2"></i>Users</a>
<a href="{{ route('admin.workshop.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-bullhorn w-4 mr-2"></i>Workshops</a> <a href="{{ route('admin.event.index') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-regular fa-calendar w-4 mr-2"></i>Events</a>
<div class="border-t border-gray-200 my-2"></div> <div class="border-t border-gray-200 my-2"></div>
@endif @endif
<a href="{{ route('account.show') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-user-pen w-4 mr-2"></i>Account</a> <a href="{{ route('account.show') }}" class="block px-4 py-2 text-sm text-gray-700 rounded transition hover:bg-sky-600 hover:text-white" role="menuitem" tabindex="-1"><i class="fa-solid fa-user-pen w-4 mr-2"></i>Account</a>

View File

@@ -1,45 +1,45 @@
@props(['workshop']) @props(['event'])
@php @php
$statusClass = $workshop->status; $statusClass = $event->status;
$statusTitle = $workshop->status; $statusTitle = $event->status;
if($workshop->status === 'scheduled') { if($event->status === 'scheduled') {
$statusClass = 'soon'; $statusClass = 'soon';
$statusTitle = 'Open soon'; $statusTitle = 'Open soon';
} }
@endphp @endphp
<a href="{{ route('workshop.show', $workshop) }}" class="flex flex-col bg-white border rounded-lg overflow-hidden hover:shadow-lg hover:scale-[101%] transition-all relative {{ $attributes->get('class') }}"> <a href="{{ route('event.show', $event) }}" class="flex flex-col bg-white border rounded-lg overflow-hidden hover:shadow-lg hover:scale-[101%] transition-all relative {{ $attributes->get('class') }}">
<div class="shadow border rounded px-3 py-2 absolute top-2 left-2 flex flex-col justify-center items-center bg-white"> <div class="shadow border rounded px-3 py-2 absolute top-2 left-2 flex flex-col justify-center items-center bg-white">
<div class="text-gray-600 font-bold leading-none">{{ $workshop->starts_at->format('j') }}</div> <div class="text-gray-600 font-bold leading-none">{{ $event->starts_at->format('j') }}</div>
<div class="text-gray-600 text-xs uppercase">{{ $workshop->starts_at->format('M') }}</div> <div class="text-gray-600 text-xs uppercase">{{ $event->starts_at->format('M') }}</div>
</div> </div>
<div class="border border-white border-opacity-50 absolute flex items-center justify-center top-5 -right-9 bg-gray-500 w-36 text-sm text-white font-bold uppercase py-1 rotate-45 h-8 sm-banner-{{ strtolower($statusClass) }}">{{ $statusTitle }}</div> <div class="border border-white border-opacity-50 absolute flex items-center justify-center top-5 -right-9 bg-gray-500 w-36 text-sm text-white font-bold uppercase py-1 rotate-45 h-8 sm-banner-{{ strtolower($statusClass) }}">{{ $statusTitle }}</div>
<img src="{{ $workshop->hero?->url }}?md" alt="{{ $workshop->title }}" class="w-full h-64 object-cover object-center"> <img src="{{ $event->hero?->url }}?md" alt="{{ $event->title }}" class="w-full h-64 object-cover object-center">
<div class="flex-grow p-4 flex flex-col"> <div class="flex-grow p-4 flex flex-col">
<h2 class="flex-grow {{ strlen($workshop->title) > 25 ? 'text-lg' : 'text-xl' }} font-bold mb-2">{{ $workshop->title }}</h2> <h2 class="flex-grow {{ strlen($event->title) > 25 ? 'text-lg' : 'text-xl' }} font-bold mb-2">{{ $event->title }}</h2>
<div class="text-gray-600 text-sm mb-1 flex gap-2"> <div class="text-gray-600 text-sm mb-1 flex gap-2">
<div class="w-6 flex items-center justify-center"> <div class="w-6 flex items-center justify-center">
<i class="fa-regular fa-calendar"></i> <i class="fa-regular fa-calendar"></i>
</div>{{ $workshop->starts_at->format('j/m/Y @ g:i a') }} </div>{{ $event->starts_at->format('j/m/Y @ g:i a') }}
</div> </div>
<div class="text-gray-600 text-sm mb-1 flex gap-2"> <div class="text-gray-600 text-sm mb-1 flex gap-2">
<div class="w-6 flex items-center justify-center"> <div class="w-6 flex items-center justify-center">
<i class="fa-solid fa-location-dot"></i> <i class="fa-solid fa-location-dot"></i>
</div>{{ $workshop->location->name }} </div>{{ $event->location->name }}
</div> </div>
@if($workshop->ages) @if($event->ages)
<div class="text-gray-600 text-sm mb-1 flex gap-2"> <div class="text-gray-600 text-sm mb-1 flex gap-2">
<div class="w-6 flex items-center justify-center"> <div class="w-6 flex items-center justify-center">
<i class="fa-regular fa-face-smile"></i> <i class="fa-regular fa-face-smile"></i>
</div>{{ isset($workshop->ages) && $workshop->ages !== '' ? 'Ages ' . $workshop->ages : 'All ages' }} </div>{{ isset($event->ages) && $event->ages !== '' ? 'Ages ' . $event->ages : 'All ages' }}
</div> </div>
@endif @endif
<div class="text-gray-600 text-sm mb-1 flex gap-2"> <div class="text-gray-600 text-sm mb-1 flex gap-2">
<div class="w-6 flex items-center justify-center"> <div class="w-6 flex items-center justify-center">
<i class="fa-solid fa-dollar-sign"></i> <i class="fa-solid fa-dollar-sign"></i>
</div>{{ isset($workshop->price) && $workshop->price !== '' && $workshop->price !== '0' ? $workshop->price : 'Free' }} </div>{{ isset($event->price) && $event->price !== '' && $event->price !== '0' ? $event->price : 'Free' }}
</div> </div>
</div> </div>
</a> </a>

View File

@@ -12,18 +12,18 @@
</form> </form>
</x-container> </x-container>
@if($workshops->isEmpty()) @if($events->isEmpty())
<x-container class="mt-8"> <x-container class="mt-8">
<x-none-found item="workshops" search="{{ request()->get('search') }}" /> <x-none-found item="workshops" search="{{ request()->get('search') }}" />
</x-container> </x-container>
@else @else
<x-container class="mt-4" inner-class="grid md:grid-cols-2 lg:grid-cols-3 gap-8 w-full"> <x-container class="mt-4" inner-class="grid md:grid-cols-2 lg:grid-cols-3 gap-8 w-full">
@foreach ($workshops as $workshop) @foreach ($events as $event)
<x-panel-workshop :workshop="$workshop" /> <x-panel-event :event="$event" />
@endforeach @endforeach
</x-container> </x-container>
<x-container> <x-container>
{{ $workshops->appends(request()->query())->links() }} {{ $events->appends(request()->query())->links() }}
</x-container> </x-container>
@endif @endif
</section> </section>

View File

@@ -0,0 +1,64 @@
<x-layout>
<x-container>
<x-ui.image-hero :image="$event->hero?->url" class="my-8" />
<div class="flex sm:gap-16 gap-4 flex-col sm:flex-row">
<div class="flex flex-col flex-1">
<h1 class="text-3xl font-bold mb-6">{!! $event->title !!}</h1>
<article class="content mb-4">{!! $event->content !!}</article>
<x-ui.filelist class="mt-16" value="{!! $event->files()->orderBy('name')->get() !!}" />
</div>
<div class="flex flex-col sm:pt-8 basis-64 flex-grow-0 flex-shrink-0">
@if($event->status === 'closed')
<div class="sm-registration-closed">Registration for this event has closed.</div>
@elseif($event->status === 'full')
<div class="sm-registration-full">This workshop is currently full.</div>
@elseif($event->status === 'private')
<div class="sm-registration-private">This is a private event. Please contact the organiser for details.</div>
@elseif($event->status === 'scheduled')
<div class="sm-registration-scheduled">Registration for this workshop will open soon.</div>
@elseif($event->status === 'cancelled')
<div class="sm-registration-cancelled">This workshop has been cancelled.</div>
@elseif($event->registration === 'none')
<div class="sm-registration-none">Registration not required for this event. Arrive early to avoid disappointment as seating maybe limited.</div>
@elseif($event->registration === 'link')
<x-ui.button href="{{ $event->registration_data }}" class="my-4">Register for Event</x-ui.button>
@elseif($event->registration === 'email')
<div class="sm-registration-email">Registration for this event by emailing <a href="mailto:{{ $event->registration_data }}" class="link">{{ $event->registration_data }}</a>.</div>
@elseif($event->registration === 'message')
<div class="sm-registration-message">{{ $event->registration_data }}</div>
@endif
@if(auth()->user()?->admin)
<x-ui.button class="mb-4" color="primary-outline" href="{{ route('admin.event.edit', $event) }}">Edit Workshop</x-ui.button>
@endif
<h2 class="text-gray-600 text-lg font-bold mt-4 mb-2"><i class="mr-1 fa-regular fa-calendar"></i> Date/Time</h2>
<p class="text-gray-600 text-sm pl-6 mb-6">{!! implode('<br />', \App\Helpers::createTimeDurationStr($event->starts_at, $event->ends_at)) !!}</p>
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-solid fa-location-dot"></i> Location</h2>
<div class="text-gray-600 text-sm pl-6 mb-6">
@if($event->location->url)
<a href="{{ $event->location->url }}" class="link">
@endif
<p>{{ $event->location->name }}</p>
@if($event->location->url)
</a>
@endif
@if($event->location->address_url)
<a href="{{ $event->location->address_url }}" class="link" target="_blank">
@endif
<p class="text-xs">{{ $event->location->address }}</p>
@if($event->location->address_url)
</a>
@endif
</div>
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-regular fa-face-smile"></i> {{ isset($event->ages) && $event->ages !== '' ? 'Ages ' . $event->ages : 'All ages' }}</h2>
@if(\App\Helpers::isUnderAge($event->ages))
<p class="text-gray-600 text-xs pl-3 ml-2 mb-6 border-l-4 border-l-yellow-400">Parental supervision may be required for children 8 years of age and under.</p>
@endif
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-solid fa-dollar-sign"></i> {{ isset($event->price) && $event->price !== '' && $event->price !== '0' ? $event->price : 'Free' }}</h2>
{{-- @if(isset($event->price) && $event->price !== '' && $event->price !== '0' && strtolower($event->price) !== 'free')--}}
{{-- <p class="text-gray-600 text-xs pl-3 ml-2 mb-6 border-l-4 border-l-green-500">Payment by cash or EFTPOS accepted. Please ensure correct change.</p>--}}
{{-- @endif--}}
</div>
</div>
</x-container>
</x-layout>

View File

@@ -33,7 +33,7 @@
<div class="self-center"> <div class="self-center">
<p class="mb-6 text-left">To keep up with our ever-changing world, it's important to encourage and support a new generation of curious minds who love science, engineering, art, and leadership.</p> <p class="mb-6 text-left">To keep up with our ever-changing world, it's important to encourage and support a new generation of curious minds who love science, engineering, art, and leadership.</p>
<div class="flex flex-grow justify-center items-center"> <div class="flex flex-grow justify-center items-center">
<x-ui.button color="success" href="{{ route('workshop.index') }}" class="font-normal">Explore Workshops</x-ui.button> <x-ui.button color="success" href="{{ route('event.index') }}" class="font-normal">Explore Workshops</x-ui.button>
</div> </div>
</div> </div>
<div class="ml-8 hidden sm:block md:hidden"> <div class="ml-8 hidden sm:block md:hidden">
@@ -46,12 +46,12 @@
<section id="events" class="pt-4 pb-8"> <section id="events" class="pt-4 pb-8">
<x-container> <x-container>
<h2 class="text-2xl font-bold mb-6">Upcoming workshops</h2> <h2 class="text-2xl font-bold mb-6">Upcoming workshops</h2>
@if($workshops->isEmpty()) @if($events->isEmpty())
<x-none-found item="workshops" message="No workshops have been scheduled at this time" title="" /> <x-none-found item="workshops" message="No workshops have been scheduled at this time" title="" />
@else @else
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8 w-full"> <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8 w-full">
@foreach($workshops as $index => $workshop) @foreach($events as $index => $event)
<x-panel-workshop :workshop="$workshop" class="{{ $index === 3 ? 'lg:hidden' : '' }}" /> <x-panel-event :event="$event" class="{{ $index === 3 ? 'lg:hidden' : '' }}" />
@endforeach @endforeach
</div> </div>
@endif @endif

View File

@@ -1,64 +0,0 @@
<x-layout>
<x-container>
<x-ui.image-hero :image="$workshop->hero?->url" class="my-8" />
<div class="flex sm:gap-16 gap-4 flex-col sm:flex-row">
<div class="flex flex-col flex-1">
<h1 class="text-3xl font-bold mb-6">{!! $workshop->title !!}</h1>
<article class="content mb-4">{!! $workshop->content !!}</article>
<x-ui.filelist class="mt-16" value="{!! $workshop->files()->orderBy('name')->get() !!}" />
</div>
<div class="flex flex-col sm:pt-8 basis-64 flex-grow-0 flex-shrink-0">
@if($workshop->status === 'closed')
<div class="sm-registration-closed">Registration for this event has closed.</div>
@elseif($workshop->status === 'full')
<div class="sm-registration-full">This workshop is currently full.</div>
@elseif($workshop->status === 'private')
<div class="sm-registration-private">This is a private event. Please contact the organiser for details.</div>
@elseif($workshop->status === 'scheduled')
<div class="sm-registration-scheduled">Registration for this workshop will open soon.</div>
@elseif($workshop->status === 'cancelled')
<div class="sm-registration-cancelled">This workshop has been cancelled.</div>
@elseif($workshop->registration === 'none')
<div class="sm-registration-none">Registration not required for this event. Arrive early to avoid disappointment as seating maybe limited.</div>
@elseif($workshop->registration === 'link')
<x-ui.button href="{{ $workshop->registration_data }}" class="my-4">Register for Event</x-ui.button>
@elseif($workshop->registration === 'email')
<div class="sm-registration-email">Registration for this event by emailing <a href="mailto:{{ $workshop->registration_data }}" class="link">{{ $workshop->registration_data }}</a>.</div>
@elseif($workshop->registration === 'message')
<div class="sm-registration-message">{{ $workshop->registration_data }}</div>
@endif
@if(auth()->user()?->admin)
<x-ui.button class="mb-4" color="primary-outline" href="{{ route('admin.workshop.edit', $workshop) }}">Edit Workshop</x-ui.button>
@endif
<h2 class="text-gray-600 text-lg font-bold mt-4 mb-2"><i class="mr-1 fa-regular fa-calendar"></i> Date/Time</h2>
<p class="text-gray-600 text-sm pl-6 mb-6">{!! implode('<br />', \App\Helpers::createTimeDurationStr($workshop->starts_at, $workshop->ends_at)) !!}</p>
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-solid fa-location-dot"></i> Location</h2>
<div class="text-gray-600 text-sm pl-6 mb-6">
@if($workshop->location->url)
<a href="{{ $workshop->location->url }}" class="link">
@endif
<p>{{ $workshop->location->name }}</p>
@if($workshop->location->url)
</a>
@endif
@if($workshop->location->address_url)
<a href="{{ $workshop->location->address_url }}" class="link" target="_blank">
@endif
<p class="text-xs">{{ $workshop->location->address }}</p>
@if($workshop->location->address_url)
</a>
@endif
</div>
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-regular fa-face-smile"></i> {{ isset($workshop->ages) && $workshop->ages !== '' ? 'Ages ' . $workshop->ages : 'All ages' }}</h2>
@if(\App\Helpers::isUnderAge($workshop->ages))
<p class="text-gray-600 text-xs pl-3 ml-2 mb-6 border-l-4 border-l-yellow-400">Parental supervision may be required for children 8 years of age and under.</p>
@endif
<h2 class="text-gray-600 text-lg font-bold mb-2"><i class="mr-1 fa-solid fa-dollar-sign"></i> {{ isset($workshop->price) && $workshop->price !== '' && $workshop->price !== '0' ? $workshop->price : 'Free' }}</h2>
{{-- @if(isset($workshop->price) && $workshop->price !== '' && $workshop->price !== '0' && strtolower($workshop->price) !== 'free')--}}
{{-- <p class="text-gray-600 text-xs pl-3 ml-2 mb-6 border-l-4 border-l-green-500">Payment by cash or EFTPOS accepted. Please ensure correct change.</p>--}}
{{-- @endif--}}
</div>
</div>
</x-container>
</x-layout>

View File

@@ -19,13 +19,13 @@ Artisan::command('cleanup', function() {
->update(['status' => 'published']); ->update(['status' => 'published']);
// Open scheduled workshops // Open scheduled workshops
DB::table('workshops') DB::table('events')
->where('status', 'scheduled') ->where('status', 'scheduled')
->where('publish_at', '<', now()) ->where('publish_at', '<', now())
->update(['status' => 'open']); ->update(['status' => 'open']);
// Close workshops // Close workshops
DB::table('workshops') DB::table('events')
->whereIn('status', ['open', 'full', 'private']) ->whereIn('status', ['open', 'full', 'private'])
->where('closes_at', '<', now()) ->where('closes_at', '<', now())
->update(['status' => 'closed']); ->update(['status' => 'closed']);

View File

@@ -7,15 +7,18 @@ use App\Http\Controllers\LocationController;
use App\Http\Controllers\MediaController; use App\Http\Controllers\MediaController;
use App\Http\Controllers\PostController; use App\Http\Controllers\PostController;
use App\Http\Controllers\UserController; use App\Http\Controllers\UserController;
use App\Http\Controllers\WorkshopController; use App\Http\Controllers\EventController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::get('/', [HomeController::class, 'index'])->name('index'); Route::get('/', [HomeController::class, 'index'])->name('index');
Route::get('posts', [PostController::class, 'index'])->name('post.index'); Route::redirect('/events', '/workshops', 301);
Route::get('posts/{post}', [PostController::class, 'show'])->name('post.show'); Route::redirect('/events/{event}', '/workshops/{event}', 301);
Route::get('workshops', [WorkshopController::class, 'index'])->name('workshop.index');
Route::get('workshops/{workshop}', [WorkshopController::class, 'show'])->name('workshop.show'); Route::get('/posts', [PostController::class, 'index'])->name('post.index');
Route::get('/posts/{post}', [PostController::class, 'show'])->name('post.show');
Route::get('/workshops', [EventController::class, 'index'])->name('event.index');
Route::get('/workshops/{event}', [EventController::class, 'show'])->name('event.show');
Route::middleware('auth')->group(function () { Route::middleware('auth')->group(function () {
Route::get('/account', [AccountController::class, 'show'])->name('account.show'); Route::get('/account', [AccountController::class, 'show'])->name('account.show');
@@ -78,12 +81,11 @@ Route::middleware('admin')->group(function () {
Route::put('/admin/users/{user}', [UserController::class, 'update'])->name('admin.user.update'); Route::put('/admin/users/{user}', [UserController::class, 'update'])->name('admin.user.update');
Route::delete('/admin/users/{user}', [UserController::class, 'destroy'])->name('admin.user.destroy'); Route::delete('/admin/users/{user}', [UserController::class, 'destroy'])->name('admin.user.destroy');
Route::get('/admin/workshops', [WorkshopController::class, 'admin_index'])->name('admin.workshop.index'); Route::get('/admin/events', [EventController::class, 'admin_index'])->name('admin.event.index');
Route::get('/admin/workshops/create', [WorkshopController::class, 'admin_create'])->name('admin.workshop.create'); Route::get('/admin/events/create', [EventController::class, 'admin_create'])->name('admin.event.create');
Route::get('/admin/workshops/{workshop}/duplicate', [WorkshopController::class, 'admin_duplicate'])->name('admin.workshop.duplicate'); Route::get('/admin/events/{event}/duplicate', [EventController::class, 'admin_duplicate'])->name('admin.event.duplicate');
Route::post('/admin/workshops', [WorkshopController::class, 'admin_store'])->name('admin.workshop.store'); Route::post('/admin/events', [EventController::class, 'admin_store'])->name('admin.event.store');
Route::get('/admin/workshops/{workshop}', [WorkshopController::class, 'admin_edit'])->name('admin.workshop.edit'); Route::get('/admin/events/{event}', [EventController::class, 'admin_edit'])->name('admin.event.edit');
Route::put('/admin/workshops/{workshop}', [WorkshopController::class, 'admin_update'])->name('admin.workshop.update'); Route::put('/admin/events/{event}', [EventController::class, 'admin_update'])->name('admin.event.update');
Route::delete('/admin/workshops/{workshop}', [WorkshopController::class, 'admin_destroy'])->name('admin.workshop.destroy'); Route::delete('/admin/events/{event}', [EventController::class, 'admin_destroy'])->name('admin.event.destroy');
}); });