From 648bc6395adb3f1558984d6ce3384c5fdf28837f Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Mon, 12 Dec 2022 17:44:24 +0100 Subject: [PATCH] meetups added --- .blueprint | 25 ++-- app/Http/Livewire/Meetup/MeetupEventTable.php | 15 +++ app/Http/Livewire/Meetup/MeetupTable.php | 15 +++ app/Http/Livewire/Tables/EventTable.php | 12 +- app/Http/Livewire/Tables/MeetupEventTable.php | 35 ++++++ app/Http/Livewire/Tables/MeetupTable.php | 29 +++++ app/Models/City.php | 2 +- app/Models/Course.php | 2 +- app/Models/{Event.php => CourseEvent.php} | 2 +- app/Models/Meetup.php | 33 ++++++ app/Models/MeetupEvent.php | 34 ++++++ app/Models/Registration.php | 2 +- app/Models/Venue.php | 4 +- app/Nova/{Event.php => CourseEvent.php} | 4 +- app/Nova/Meetup.php | 101 ++++++++++++++++ app/Nova/MeetupEvent.php | 111 ++++++++++++++++++ app/Nova/Registration.php | 3 +- app/Observers/EventObserver.php | 22 ++-- ...{EventPolicy.php => CourseEventPolicy.php} | 31 +++-- app/Policies/MeetupEventPolicy.php | 94 +++++++++++++++ app/Policies/MeetupPolicy.php | 101 ++++++++++++++++ app/Providers/NovaServiceProvider.php | 15 ++- composer.json | 1 + composer.lock | 64 +++++++++- database/factories/EventFactory.php | 4 +- database/factories/MeetupEventFactory.php | 36 ++++++ database/factories/MeetupFactory.php | 32 +++++ database/factories/RegistrationFactory.php | 4 +- ..._01_145955_create_course_events_table.php} | 6 +- ...2_01_145956_create_registrations_table.php | 2 +- ...add_link_field_to_course_events_table.php} | 4 +- ...2022_12_12_155928_create_meetups_table.php | 38 ++++++ ...2_12_155929_create_meetup_events_table.php | 44 +++++++ database/seeders/DatabaseSeeder.php | 31 +++-- draft.yaml | 13 ++ .../views/livewire/frontend/header.blade.php | 21 ++++ .../views/livewire/frontend/welcome.blade.php | 14 +-- .../meetup/meetup-event-table.blade.php | 12 ++ .../livewire/meetup/meetup-table.blade.php | 12 ++ resources/views/navigation-menu.blade.php | 49 +++++--- routes/web.php | 9 ++ 41 files changed, 995 insertions(+), 93 deletions(-) create mode 100644 app/Http/Livewire/Meetup/MeetupEventTable.php create mode 100644 app/Http/Livewire/Meetup/MeetupTable.php create mode 100644 app/Http/Livewire/Tables/MeetupEventTable.php create mode 100644 app/Http/Livewire/Tables/MeetupTable.php rename app/Models/{Event.php => CourseEvent.php} (96%) create mode 100644 app/Models/Meetup.php create mode 100644 app/Models/MeetupEvent.php rename app/Nova/{Event.php => CourseEvent.php} (96%) create mode 100644 app/Nova/Meetup.php create mode 100644 app/Nova/MeetupEvent.php rename app/Policies/{EventPolicy.php => CourseEventPolicy.php} (67%) create mode 100644 app/Policies/MeetupEventPolicy.php create mode 100644 app/Policies/MeetupPolicy.php create mode 100644 database/factories/MeetupEventFactory.php create mode 100644 database/factories/MeetupFactory.php rename database/migrations/{2022_12_01_145955_create_events_table.php => 2022_12_01_145955_create_course_events_table.php} (83%) rename database/migrations/{2022_12_03_183452_add_link_field_to_events_table.php => 2022_12_03_183452_add_link_field_to_course_events_table.php} (76%) create mode 100644 database/migrations/2022_12_12_155928_create_meetups_table.php create mode 100644 database/migrations/2022_12_12_155929_create_meetup_events_table.php create mode 100644 resources/views/livewire/meetup/meetup-event-table.blade.php create mode 100644 resources/views/livewire/meetup/meetup-table.blade.php diff --git a/.blueprint b/.blueprint index 31acea7a..1312ea02 100644 --- a/.blueprint +++ b/.blueprint @@ -1,28 +1,33 @@ created: - - database/factories/OrangePillFactory.php - - database/migrations/2022_12_07_095709_create_orange_pills_table.php - - app/Models/OrangePill.php - - app/Nova/OrangePill.php + - database/factories/MeetupFactory.php + - database/factories/MeetupEventFactory.php + - database/migrations/2022_12_12_155928_create_meetups_table.php + - database/migrations/2022_12_12_155929_create_meetup_events_table.php + - app/Models/Meetup.php + - app/Models/MeetupEvent.php + - app/Nova/Meetup.php + - app/Nova/MeetupEvent.php models: + BookCase: { title: string, latitude: 'float:10', longitude: 'float:10', address: 'text nullable', type: string, open: 'string nullable', comment: 'text nullable', contact: 'text nullable', bcz: 'text nullable', digital: boolean, icontype: string, deactivated: boolean, deactreason: string, entrytype: string, homepage: 'text nullable' } Category: { name: string, slug: string } City: { country_id: biginteger, name: string, slug: string, longitude: 'float:10', latitude: 'float:10' } Country: { name: string, code: string, language_codes: 'json default:[]' } Course: { lecturer_id: biginteger, name: string, description: 'text nullable' } + CourseEvent: { course_id: biginteger, venue_id: biginteger, '"from"': datetime, '"to"': datetime, link: string } Episode: { guid: string, podcast_id: biginteger, data: json } - Event: { course_id: biginteger, venue_id: biginteger, '"from"': datetime, '"to"': datetime, link: string } Lecturer: { team_id: biginteger, name: string, slug: string, active: 'boolean default:1', description: 'text nullable' } Library: { name: string, is_public: 'boolean default:1', language_codes: 'json default:[]' } LibraryItem: { lecturer_id: biginteger, episode_id: 'biginteger nullable', order_column: integer, name: string, type: string, language_code: string, value: 'text nullable' } LoginKey: { k1: string, user_id: biginteger } Membership: { team_id: biginteger, user_id: biginteger, role: 'string nullable' } + OrangePill: { user_id: biginteger, book_case_id: biginteger, date: datetime, amount: integer } Participant: { first_name: string, last_name: string } - Podcast: { guid: string, title: string, link: string, language_code: string, data: json } - Registration: { event_id: biginteger, participant_id: biginteger, active: 'boolean default:1' } + Podcast: { guid: string, locked: 'boolean default:1', title: string, link: string, language_code: string, data: 'json nullable' } + Registration: { course_event_id: biginteger, participant_id: biginteger, active: 'boolean default:1' } Tag: { name: json, slug: json, type: 'string nullable', order_column: 'integer nullable', icon: 'string default:tag' } Team: { user_id: biginteger, name: string, personal_team: boolean } TeamInvitation: { team_id: biginteger, email: string, role: 'string nullable' } User: { name: string, public_key: 'string nullable', email: 'string nullable', email_verified_at: 'datetime nullable', password: 'string nullable', remember_token: 'string:100 nullable', current_team_id: 'biginteger nullable', profile_photo_path: 'string:2048 nullable', is_lecturer: 'boolean default:', two_factor_secret: 'text nullable', two_factor_recovery_codes: 'text nullable', two_factor_confirmed_at: 'datetime nullable', timezone: 'string default:Europe/Berlin' } Venue: { city_id: biginteger, name: string, slug: string, street: string } - Case: { title: string, lat: double, lon: json, address: text, type: string, open: string, comment: text, contact: text, bcz: text, digital: boolean, icontype: string, deactivated: boolean, deactreason: string, entrytype: string, homepage: string } - BookCase: { title: string, lat: double, lon: json, address: text, type: string, open: string, comment: text, contact: text, bcz: text, digital: boolean, icontype: string, deactivated: boolean, deactreason: string, entrytype: string, homepage: string } - OrangePill: { user_id: foreign, book_case_id: foreign, date: datetime, amount: 'integer unsigned' } + Meetup: { city_id: foreign, name: 'string unique', link: string } + MeetupEvent: { meetup_id: foreign, date: date, start: time, end: time, location: string, description: text, link: string } diff --git a/app/Http/Livewire/Meetup/MeetupEventTable.php b/app/Http/Livewire/Meetup/MeetupEventTable.php new file mode 100644 index 00000000..7486d3c7 --- /dev/null +++ b/app/Http/Livewire/Meetup/MeetupEventTable.php @@ -0,0 +1,15 @@ +withCount([ + return CourseEvent::query() + ->withCount([ 'registrations', ]) - ->whereHas('venue.city.country', + ->whereHas('venue.city.country', fn($query) => $query->where('countries.code', $this->country)); } public function viewHistoryModal($modelId): void { $this->viewingModal = true; - $this->currentModal = Event::findOrFail($modelId); + $this->currentModal = CourseEvent::findOrFail($modelId); } public function resetModal(): void diff --git a/app/Http/Livewire/Tables/MeetupEventTable.php b/app/Http/Livewire/Tables/MeetupEventTable.php new file mode 100644 index 00000000..d8b05e6e --- /dev/null +++ b/app/Http/Livewire/Tables/MeetupEventTable.php @@ -0,0 +1,35 @@ +setPrimaryKey('id'); + } + + public function columns(): array + { + return [ + Column::make(__('Location'), 'location') + ->sortable(), + Column::make(__('Start'), 'start') + ->sortable(), + Column::make(__('Link'), 'link') + ->sortable(), + Column::make("Created at", "created_at") + ->sortable(), + Column::make("Updated at", "updated_at") + ->sortable(), + ]; + } +} diff --git a/app/Http/Livewire/Tables/MeetupTable.php b/app/Http/Livewire/Tables/MeetupTable.php new file mode 100644 index 00000000..c42a3ce0 --- /dev/null +++ b/app/Http/Livewire/Tables/MeetupTable.php @@ -0,0 +1,29 @@ +setPrimaryKey('id'); + } + + public function columns(): array + { + return [ + Column::make(__('Name'), 'name') + ->sortable(), + Column::make(__('Link'), 'link') + ->sortable(), + ]; + } +} diff --git a/app/Models/City.php b/app/Models/City.php index 9f17e36f..25e8d194 100644 --- a/app/Models/City.php +++ b/app/Models/City.php @@ -52,6 +52,6 @@ class City extends Model function events() { - return $this->hasManyThrough(Event::class, Venue::class); + return $this->hasManyThrough(CourseEvent::class, Venue::class); } } diff --git a/app/Models/Course.php b/app/Models/Course.php index c0c826fd..228a065c 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -66,6 +66,6 @@ class Course extends Model implements HasMedia public function events(): \Illuminate\Database\Eloquent\Relations\HasMany { - return $this->hasMany(Event::class); + return $this->hasMany(CourseEvent::class); } } diff --git a/app/Models/Event.php b/app/Models/CourseEvent.php similarity index 96% rename from app/Models/Event.php rename to app/Models/CourseEvent.php index bf905eff..53263274 100644 --- a/app/Models/Event.php +++ b/app/Models/CourseEvent.php @@ -5,7 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -class Event extends Model +class CourseEvent extends Model { use HasFactory; diff --git a/app/Models/Meetup.php b/app/Models/Meetup.php new file mode 100644 index 00000000..758d464a --- /dev/null +++ b/app/Models/Meetup.php @@ -0,0 +1,33 @@ + 'integer', + 'city_id' => 'integer', + ]; + + public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(City::class); + } +} diff --git a/app/Models/MeetupEvent.php b/app/Models/MeetupEvent.php new file mode 100644 index 00000000..5cb14f6d --- /dev/null +++ b/app/Models/MeetupEvent.php @@ -0,0 +1,34 @@ + 'integer', + 'meetup_id' => 'integer', + 'start' => 'datetime', + ]; + + public function meetup(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Meetup::class); + } +} diff --git a/app/Models/Registration.php b/app/Models/Registration.php index 9b57027a..ef5ff814 100644 --- a/app/Models/Registration.php +++ b/app/Models/Registration.php @@ -30,7 +30,7 @@ class Registration extends Model public function event(): \Illuminate\Database\Eloquent\Relations\BelongsTo { - return $this->belongsTo(Event::class); + return $this->belongsTo(CourseEvent::class); } public function participant(): \Illuminate\Database\Eloquent\Relations\BelongsTo diff --git a/app/Models/Venue.php b/app/Models/Venue.php index e7f28de8..5d4a6e31 100644 --- a/app/Models/Venue.php +++ b/app/Models/Venue.php @@ -75,11 +75,11 @@ class Venue extends Model implements HasMedia public function courses() { - return $this->hasManyDeepFromRelations($this->events(), (new Event())->course()); + return $this->hasManyDeepFromRelations($this->events(), (new CourseEvent())->course()); } public function events(): \Illuminate\Database\Eloquent\Relations\HasMany { - return $this->hasMany(Event::class); + return $this->hasMany(CourseEvent::class); } } diff --git a/app/Nova/Event.php b/app/Nova/CourseEvent.php similarity index 96% rename from app/Nova/Event.php rename to app/Nova/CourseEvent.php index 1e7a6e6c..aa068d7b 100644 --- a/app/Nova/Event.php +++ b/app/Nova/CourseEvent.php @@ -11,13 +11,13 @@ use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\URL; use Laravel\Nova\Http\Requests\NovaRequest; -class Event extends Resource +class CourseEvent extends Resource { /** * The model the resource corresponds to. * @var string */ - public static $model = \App\Models\Event::class; + public static $model = \App\Models\CourseEvent::class; /** * The columns that should be searched. * @var array diff --git a/app/Nova/Meetup.php b/app/Nova/Meetup.php new file mode 100644 index 00000000..59d749db --- /dev/null +++ b/app/Nova/Meetup.php @@ -0,0 +1,101 @@ +sortable(), + + Text::make('Name') + ->rules('required', 'string', 'unique:meetups,name'), + + Text::make('Link') + ->rules('required', 'string'), + + BelongsTo::make('City')->searchable(), + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/MeetupEvent.php b/app/Nova/MeetupEvent.php new file mode 100644 index 00000000..a3a9d13f --- /dev/null +++ b/app/Nova/MeetupEvent.php @@ -0,0 +1,111 @@ +sortable(), + + DateTime::make(__('Start'), 'start'), + + Text::make('Location') + ->rules('required', 'string'), + + Text::make('Description') + ->rules('required', 'string') + ->hideFromIndex(), + + Text::make('Link') + ->rules('required', 'string'), + + BelongsTo::make('Meetup') + ->searchable(), + + ]; + } + + /** + * Get the cards available for the request. + * + * @param \Illuminate\Http\Request $request + * + * @return array + */ + public function cards(Request $request) + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @param \Illuminate\Http\Request $request + * + * @return array + */ + public function filters(Request $request) + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @param \Illuminate\Http\Request $request + * + * @return array + */ + public function lenses(Request $request) + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @param \Illuminate\Http\Request $request + * + * @return array + */ + public function actions(Request $request) + { + return []; + } +} diff --git a/app/Nova/Registration.php b/app/Nova/Registration.php index 5c5d8b93..b4b1d842 100644 --- a/app/Nova/Registration.php +++ b/app/Nova/Registration.php @@ -46,10 +46,9 @@ class Registration extends Resource Boolean::make('Active') ->rules('required'), - BelongsTo::make('Event'), + BelongsTo::make('Course Event'), BelongsTo::make('Participant'), - ]; } diff --git a/app/Observers/EventObserver.php b/app/Observers/EventObserver.php index 1b083fed..92716e4c 100644 --- a/app/Observers/EventObserver.php +++ b/app/Observers/EventObserver.php @@ -2,18 +2,18 @@ namespace App\Observers; -use App\Models\Event; +use App\Models\CourseEvent; class EventObserver { /** * Handle the Event "created" event. * - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $event * * @return void */ - public function created(Event $event) + public function created(CourseEvent $event) { // } @@ -21,11 +21,11 @@ class EventObserver /** * Handle the Event "updated" event. * - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $event * * @return void */ - public function updated(Event $event) + public function updated(CourseEvent $event) { // } @@ -33,11 +33,11 @@ class EventObserver /** * Handle the Event "deleted" event. * - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $event * * @return void */ - public function deleted(Event $event) + public function deleted(CourseEvent $event) { // } @@ -45,11 +45,11 @@ class EventObserver /** * Handle the Event "restored" event. * - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $event * * @return void */ - public function restored(Event $event) + public function restored(CourseEvent $event) { // } @@ -57,11 +57,11 @@ class EventObserver /** * Handle the Event "force deleted" event. * - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $event * * @return void */ - public function forceDeleted(Event $event) + public function forceDeleted(CourseEvent $event) { // } diff --git a/app/Policies/EventPolicy.php b/app/Policies/CourseEventPolicy.php similarity index 67% rename from app/Policies/EventPolicy.php rename to app/Policies/CourseEventPolicy.php index ff8f4262..e1d2c6c0 100644 --- a/app/Policies/EventPolicy.php +++ b/app/Policies/CourseEventPolicy.php @@ -2,11 +2,11 @@ namespace App\Policies; -use App\Models\Event; +use App\Models\CourseEvent; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; -class EventPolicy extends BasePolicy +class CourseEventPolicy extends BasePolicy { use HandlesAuthorization; @@ -25,10 +25,11 @@ class EventPolicy extends BasePolicy * Determine whether the user can view the model. * * @param \App\Models\User $user - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $courseEvent + * * @return \Illuminate\Auth\Access\Response|bool */ - public function view(User $user, Event $event) + public function view(User $user, CourseEvent $courseEvent) { return $user->is_lecturer; } @@ -48,22 +49,24 @@ class EventPolicy extends BasePolicy * Determine whether the user can update the model. * * @param \App\Models\User $user - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $courseEvent + * * @return \Illuminate\Auth\Access\Response|bool */ - public function update(User $user, Event $event) + public function update(User $user, CourseEvent $courseEvent) { - return $user->belongsToTeam($event->course->lecturer->team); + return $user->belongsToTeam($courseEvent->course->lecturer->team); } /** * Determine whether the user can delete the model. * * @param \App\Models\User $user - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $courseEvent + * * @return \Illuminate\Auth\Access\Response|bool */ - public function delete(User $user, Event $event) + public function delete(User $user, CourseEvent $courseEvent) { // } @@ -72,10 +75,11 @@ class EventPolicy extends BasePolicy * Determine whether the user can restore the model. * * @param \App\Models\User $user - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $courseEvent + * * @return \Illuminate\Auth\Access\Response|bool */ - public function restore(User $user, Event $event) + public function restore(User $user, CourseEvent $courseEvent) { // } @@ -84,10 +88,11 @@ class EventPolicy extends BasePolicy * Determine whether the user can permanently delete the model. * * @param \App\Models\User $user - * @param \App\Models\Event $event + * @param \App\Models\CourseEvent $courseEvent + * * @return \Illuminate\Auth\Access\Response|bool */ - public function forceDelete(User $user, Event $event) + public function forceDelete(User $user, CourseEvent $courseEvent) { // } diff --git a/app/Policies/MeetupEventPolicy.php b/app/Policies/MeetupEventPolicy.php new file mode 100644 index 00000000..6f9d7ef6 --- /dev/null +++ b/app/Policies/MeetupEventPolicy.php @@ -0,0 +1,94 @@ +icon('lightning-bolt'), + MenuSection::make('Meetups', [ + MenuItem::resource(Meetup::class), + MenuItem::resource(MeetupEvent::class), + ]) + ->icon('calendar') + ->collapsable(), + MenuSection::make('Schule', [ MenuItem::resource(City::class), MenuItem::resource(Venue::class), MenuItem::resource(Lecturer::class), MenuItem::resource(Course::class), - MenuItem::resource(Event::class), + MenuItem::resource(CourseEvent::class), MenuItem::resource(Participant::class), MenuItem::resource(Registration::class), ]) @@ -71,7 +80,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider ->icon('microphone') ->collapsable(), - MenuSection::make('Books', [ + MenuSection::make('Book-Cases', [ MenuItem::resource(BookCase::class), MenuItem::resource(OrangePill::class), ]) diff --git a/composer.json b/composer.json index 33960fb9..b3d10be9 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "laravel/tinker": "^2.7", "livewire/livewire": "^2.5", "nova/start": "*", + "oneduo/nova-time-field": "^1.0", "podcastindex/podcastindex-php": "^1.0", "rappasoft/laravel-livewire-tables": "^2.8", "sentry/sentry-laravel": "^3.1", diff --git a/composer.lock b/composer.lock index b09f8055..b700041b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8289fc02dc91d846d7179784df552d42", + "content-hash": "f361449843e880ec16cbc06c10871928", "packages": [ { "name": "akuechler/laravel-geoly", @@ -4631,6 +4631,68 @@ ], "time": "2022-06-22T07:13:36+00:00" }, + { + "name": "oneduo/nova-time-field", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/oneduo/nova-time-field.git", + "reference": "4c353e41b55b73d13eeb80b61898d284a26d66cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/oneduo/nova-time-field/zipball/4c353e41b55b73d13eeb80b61898d284a26d66cf", + "reference": "4c353e41b55b73d13eeb80b61898d284a26d66cf", + "shasum": "" + }, + "require": { + "laravel/nova": "^4.0", + "php": "^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.0.1", + "laravel/pint": "^1.2", + "mockery/mockery": "^1.5", + "orchestra/testbench": "^6.24|^7.6", + "pestphp/pest": "^1.21", + "pestphp/pest-plugin-laravel": "^1.2", + "pestphp/pest-plugin-mock": "^1.0", + "spatie/laravel-ray": "^1.29" + }, + "type": "library", + "autoload": { + "psr-4": { + "Oneduo\\NovaTimeField\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mikaël Popowicz", + "email": "mikael@popowicz.fr" + }, + { + "name": "Charaf Rezrazi", + "email": "charaf@rezrazi.fr" + } + ], + "description": "A Laravel Nova time field", + "homepage": "https://github.com/oneduo/nova-time-field", + "keywords": [ + "field", + "laravel", + "nova", + "time" + ], + "support": { + "issues": "https://github.com/oneduo/nova-time-field/issues", + "source": "https://github.com/oneduo/nova-time-field/tree/v1.0.0" + }, + "time": "2022-11-18T17:20:22+00:00" + }, { "name": "openspout/openspout", "version": "v3.7.4", diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php index f321b740..7d20da21 100644 --- a/database/factories/EventFactory.php +++ b/database/factories/EventFactory.php @@ -5,7 +5,7 @@ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; use App\Models\Course; -use App\Models\Event; +use App\Models\CourseEvent; use App\Models\Venue; class EventFactory extends Factory @@ -15,7 +15,7 @@ class EventFactory extends Factory * * @var string */ - protected $model = Event::class; + protected $model = CourseEvent::class; /** * Define the model's default state. diff --git a/database/factories/MeetupEventFactory.php b/database/factories/MeetupEventFactory.php new file mode 100644 index 00000000..7d5f5772 --- /dev/null +++ b/database/factories/MeetupEventFactory.php @@ -0,0 +1,36 @@ + Meetup::factory(), + 'date' => $this->faker->date(), + 'start' => $this->faker->time(), + 'end' => $this->faker->time(), + 'location' => $this->faker->word, + 'description' => $this->faker->text, + 'link' => $this->faker->word, + ]; + } +} diff --git a/database/factories/MeetupFactory.php b/database/factories/MeetupFactory.php new file mode 100644 index 00000000..a8df6687 --- /dev/null +++ b/database/factories/MeetupFactory.php @@ -0,0 +1,32 @@ + City::factory(), + 'name' => $this->faker->name, + 'link' => $this->faker->word, + ]; + } +} diff --git a/database/factories/RegistrationFactory.php b/database/factories/RegistrationFactory.php index 92922f89..d2c6087f 100644 --- a/database/factories/RegistrationFactory.php +++ b/database/factories/RegistrationFactory.php @@ -4,7 +4,7 @@ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; -use App\Models\Event; +use App\Models\CourseEvent; use App\Models\Participant; use App\Models\Registration; @@ -25,7 +25,7 @@ class RegistrationFactory extends Factory public function definition(): array { return [ - 'event_id' => Event::factory(), + 'event_id' => CourseEvent::factory(), 'participant_id' => Participant::factory(), 'active' => $this->faker->boolean, ]; diff --git a/database/migrations/2022_12_01_145955_create_events_table.php b/database/migrations/2022_12_01_145955_create_course_events_table.php similarity index 83% rename from database/migrations/2022_12_01_145955_create_events_table.php rename to database/migrations/2022_12_01_145955_create_course_events_table.php index 1921b7b7..2c2ae0dd 100644 --- a/database/migrations/2022_12_01_145955_create_events_table.php +++ b/database/migrations/2022_12_01_145955_create_course_events_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateEventsTable extends Migration +class CreateCourseEventsTable extends Migration { /** * Run the migrations. @@ -15,7 +15,7 @@ class CreateEventsTable extends Migration { Schema::disableForeignKeyConstraints(); - Schema::create('events', function (Blueprint $table) { + Schema::create('course_events', function (Blueprint $table) { $table->id(); $table->foreignId('course_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); $table->foreignId('venue_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); @@ -34,6 +34,6 @@ class CreateEventsTable extends Migration */ public function down(): void { - Schema::dropIfExists('events'); + Schema::dropIfExists('course_events'); } } diff --git a/database/migrations/2022_12_01_145956_create_registrations_table.php b/database/migrations/2022_12_01_145956_create_registrations_table.php index 62f218c4..e25708bf 100644 --- a/database/migrations/2022_12_01_145956_create_registrations_table.php +++ b/database/migrations/2022_12_01_145956_create_registrations_table.php @@ -17,7 +17,7 @@ class CreateRegistrationsTable extends Migration Schema::create('registrations', function (Blueprint $table) { $table->id(); - $table->foreignId('event_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary(); + $table->foreignId('course_event_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary(); $table->foreignId('participant_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate()->primary(); $table->boolean('active')->default(true); $table->timestamps(); diff --git a/database/migrations/2022_12_03_183452_add_link_field_to_events_table.php b/database/migrations/2022_12_03_183452_add_link_field_to_course_events_table.php similarity index 76% rename from database/migrations/2022_12_03_183452_add_link_field_to_events_table.php rename to database/migrations/2022_12_03_183452_add_link_field_to_course_events_table.php index 1618bba0..b6a1ad0a 100644 --- a/database/migrations/2022_12_03_183452_add_link_field_to_events_table.php +++ b/database/migrations/2022_12_03_183452_add_link_field_to_course_events_table.php @@ -11,7 +11,7 @@ return new class extends Migration { */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('course_events', function (Blueprint $table) { $table->string('link'); }); } @@ -22,7 +22,7 @@ return new class extends Migration { */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('course_events', function (Blueprint $table) { // }); } diff --git a/database/migrations/2022_12_12_155928_create_meetups_table.php b/database/migrations/2022_12_12_155928_create_meetups_table.php new file mode 100644 index 00000000..4af9e5e1 --- /dev/null +++ b/database/migrations/2022_12_12_155928_create_meetups_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('city_id')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('name')->unique(); + $table->string('link'); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::dropIfExists('meetups'); + } +} diff --git a/database/migrations/2022_12_12_155929_create_meetup_events_table.php b/database/migrations/2022_12_12_155929_create_meetup_events_table.php new file mode 100644 index 00000000..46ee0fee --- /dev/null +++ b/database/migrations/2022_12_12_155929_create_meetup_events_table.php @@ -0,0 +1,44 @@ +id(); + $table->foreignId('meetup_id') + ->constrained() + ->cascadeOnDelete() + ->cascadeOnUpdate(); + $table->dateTime('start'); + $table->string('location') + ->nullable(); + $table->text('description') + ->nullable(); + $table->string('link') + ->nullable(); + $table->timestamps(); + }); + + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + * @return void + */ + public function down(): void + { + Schema::dropIfExists('meetup_events'); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index e1054608..33c13045 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -10,10 +10,12 @@ use App\Models\Category; use App\Models\City; use App\Models\Country; use App\Models\Course; -use App\Models\Event; +use App\Models\CourseEvent; use App\Models\Lecturer; use App\Models\Library; use App\Models\LibraryItem; +use App\Models\Meetup; +use App\Models\MeetupEvent; use App\Models\Participant; use App\Models\Registration; use App\Models\Team; @@ -170,7 +172,7 @@ class DatabaseSeeder extends Seeder 'first_name' => 'Roman', 'last_name' => 'Reher', ]); - Event::create([ + CourseEvent::create([ 'course_id' => 2, 'venue_id' => 1, 'link' => 'https://einundzwanzig.space', @@ -182,7 +184,7 @@ class DatabaseSeeder extends Seeder ->startOfDay() ->addHour(), ]); - Event::create([ + CourseEvent::create([ 'course_id' => 1, 'venue_id' => 2, 'link' => 'https://einundzwanzig.space', @@ -194,7 +196,7 @@ class DatabaseSeeder extends Seeder ->startOfDay() ->addHour(), ]); - Event::create([ + CourseEvent::create([ 'course_id' => 1, 'venue_id' => 3, 'link' => 'https://einundzwanzig.space', @@ -206,7 +208,7 @@ class DatabaseSeeder extends Seeder ->startOfDay() ->addHour(), ]); - Event::create([ + CourseEvent::create([ 'course_id' => 3, 'venue_id' => 3, 'link' => 'https://einundzwanzig.space', @@ -219,8 +221,8 @@ class DatabaseSeeder extends Seeder ->addHour(), ]); Registration::create([ - 'event_id' => 1, - 'participant_id' => 1, + 'course_event_id' => 1, + 'participant_id' => 1, ]); $library = Library::create([ 'name' => 'Einundzwanzig', @@ -281,5 +283,20 @@ class DatabaseSeeder extends Seeder ->attach($libraryItem); Artisan::call(ReadAndSyncEinundzwanzigPodcastFeed::class); Artisan::call(SyncOpenBooks::class); + Meetup::create([ + 'city_id' => 1, + 'name' => 'Einundzwanzig Kempten', + 'link' => 'https://t.me/EinundzwanzigKempten', + ]); + MeetupEvent::create([ + 'meetup_id' => 1, + 'start' => now() + ->addDays(2) + ->startOfDay() + ->addHours(20), + 'location' => 'Einundzwanzig Kempten', + 'description' => fake()->text(), + 'link' => 'https://t.me/EinundzwanzigKempten', + ]); } } diff --git a/draft.yaml b/draft.yaml index e69de29b..dc2463f5 100644 --- a/draft.yaml +++ b/draft.yaml @@ -0,0 +1,13 @@ +models: + Meetup: + city_id: foreign + name: string:unique + link: string + MeetupEvent: + meetup_id: foreign + date: date + start: time + end: time:nullable + location: string:nullable + description: text:nullable + link: string:nullable diff --git a/resources/views/livewire/frontend/header.blade.php b/resources/views/livewire/frontend/header.blade.php index 9a1cb639..db228ef8 100644 --- a/resources/views/livewire/frontend/header.blade.php +++ b/resources/views/livewire/frontend/header.blade.php @@ -56,6 +56,16 @@ Bücher-Schränke @endif + @if(str(request()->route()->getName())->contains('meetup.')) + + Meetups + + + Meetup-Termine + + @endif @@ -117,6 +127,17 @@ @endif + @if(str(request()->route()->getName())->contains('meetup.')) +
+

+ Bitcoiner Meetups + Plebs together strong 💪 +

+

Finde Bitcoiner in deiner Stadt und lerne sie auf einem der Meetups kennen.

+
+ @endif + diff --git a/resources/views/livewire/frontend/welcome.blade.php b/resources/views/livewire/frontend/welcome.blade.php index 35318654..3832e51f 100644 --- a/resources/views/livewire/frontend/welcome.blade.php +++ b/resources/views/livewire/frontend/welcome.blade.php @@ -14,7 +14,7 @@
- -
+ --}} diff --git a/resources/views/livewire/meetup/meetup-event-table.blade.php b/resources/views/livewire/meetup/meetup-event-table.blade.php new file mode 100644 index 00000000..551604c4 --- /dev/null +++ b/resources/views/livewire/meetup/meetup-event-table.blade.php @@ -0,0 +1,12 @@ +
+ {{-- HEADER --}} + + {{-- MAIN --}} +
+
+ +
+
+ {{-- FOOTER --}} + +
diff --git a/resources/views/livewire/meetup/meetup-table.blade.php b/resources/views/livewire/meetup/meetup-table.blade.php new file mode 100644 index 00000000..ee4bb54c --- /dev/null +++ b/resources/views/livewire/meetup/meetup-table.blade.php @@ -0,0 +1,12 @@ +
+ {{-- HEADER --}} + + {{-- MAIN --}} +
+
+ +
+
+ {{-- FOOTER --}} + +
diff --git a/resources/views/navigation-menu.blade.php b/resources/views/navigation-menu.blade.php index 52c38a7e..6c58c4ec 100644 --- a/resources/views/navigation-menu.blade.php +++ b/resources/views/navigation-menu.blade.php @@ -12,21 +12,40 @@