From 4c2447156dfffbeb12976f10b6228c23582c7dfb Mon Sep 17 00:00:00 2001 From: RichardGL11 Date: Sun, 23 Nov 2025 22:34:13 -0300 Subject: [PATCH 1/4] wip --- .../components/sections/hero.blade.php | 22 ++++++-- .../components/sections/info.blade.php | 12 +++-- .../components/sections/schedule.blade.php | 49 ++++------------- .../components/sections/speakers.blade.php | 3 ++ .../themes/3pontos/homepage.blade.php | 8 +-- .../src/Filament/Events/EventLandingPage.php | 25 ++++++--- app-modules/events/src/Models/EventModel.php | 29 ++++++++++ app-modules/events/src/Models/Talk.php | 15 ++++++ database/seeders/ThreeDotsSeeder.php | 53 ++++++++++++++----- 9 files changed, 147 insertions(+), 69 deletions(-) diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/hero.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/hero.blade.php index 8108a871..40a2340d 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/hero.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/hero.blade.php @@ -1,3 +1,16 @@ +@php + use Illuminate\Support\Facades\Date; +@endphp + +@props([ + 'event', +]) +@php + $eventStart = $event->start; + $eventEnd = $event->end; + $diffHours = $event->duration; +@endphp +
@@ -21,10 +34,9 @@ class="spin-slow h-auto w-full object-contain" 3 Pontos Start - Participe do primeiro evento presencial da 3Pontos + {{ $event->title }} - Um evento híbrido de 5 horas, em parceria com a He4rt, com palestras exclusivas, networking e uma missão - social que transforma. + {{ $event->description }} Faça sua inscrição @@ -44,7 +56,9 @@ class="bg-elevation-surface/32 border-outline-dark/60 grid w-full grid-cols-1 ga Horário
- 15h ~ 20h - Duração: 5h + + {{ $eventStart }} ~ {{ $eventEnd }} Duração: {{ $diffHours }}h + diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php index 1f52f4ef..43381b90 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/info.blade.php @@ -1,3 +1,6 @@ +@props([ + 'event', +])
@@ -15,9 +18,7 @@ icon="heroicon-o-map-pin" class="text-icon-light bg-transparent p-0!" /> - - Endereço: R. Aspicuelta, 422 - Vila Madalena, São Paulo - SP, 05416-011 - + Endereço: {{ $event->location }}
- Horário: Sábado (3/12) - 14:00 até 19:00 + + Horário: {{ $event->start_at->format('D') }} {{ $event->day }} - {{ $event->start }} + até {{ $event->end }} +
diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/schedule.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/schedule.blade.php index 7d93169e..6bbb660f 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/schedule.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/schedule.blade.php @@ -1,3 +1,6 @@ +@props([ + 'event', +])
@@ -13,45 +16,13 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @forelse ($event->talks as $talk) + + + + @empty +

There is no talk yet.

+ @endforelse
diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php index badce9a1..de13e3a6 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php @@ -1,3 +1,6 @@ +@props([ + 'event', +])
- + - - + + - +
diff --git a/app-modules/events/src/Filament/Events/EventLandingPage.php b/app-modules/events/src/Filament/Events/EventLandingPage.php index 42272028..2c0b1d44 100644 --- a/app-modules/events/src/Filament/Events/EventLandingPage.php +++ b/app-modules/events/src/Filament/Events/EventLandingPage.php @@ -6,18 +6,18 @@ use Filament\Pages\Dashboard; use Filament\Support\Enums\Width; +use He4rt\Tenant\Models\Tenant; class EventLandingPage extends Dashboard { + public $tenant; + protected static bool $shouldRegisterNavigation = false; protected Width|string|null $maxContentWidth = Width::Full; - public function mount(): void {} - - public function getView(): string + public function mount(): void { - if (app()->isLocal()) { $tenantSlug = str(request()->path())->explode('/') ->get(1); @@ -26,9 +26,15 @@ public function getView(): string $tenantSlug = array_shift($path); } - $tenantSlug = str($tenantSlug)->replace(['.', '-'], ''); + $tenantSlug = str($tenantSlug)->replace(['.', '-'], '')->toString(); + + $this->tenant = Tenant::query()->where('slug', $tenantSlug)->firstOrFail(); + + } - $view = sprintf('events::components.themes.%s.homepage', $tenantSlug); + public function getView(): string + { + $view = sprintf('events::components.themes.%s.homepage', $this->tenant->slug); abort_unless(view()->exists($view), 403, 'Forbidden Tenant'); @@ -49,4 +55,11 @@ public function getLayout(): string { return 'he4rt::components.base.index'; } + + protected function getViewData(): array + { + return [ + 'event' => $this->tenant->events()->first(), + ]; + } } diff --git a/app-modules/events/src/Models/EventModel.php b/app-modules/events/src/Models/EventModel.php index bb880cb2..0d5d30d2 100644 --- a/app-modules/events/src/Models/EventModel.php +++ b/app-modules/events/src/Models/EventModel.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Attributes\Scope; use Illuminate\Database\Eloquent\Attributes\UseFactory; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -156,6 +157,34 @@ public function speakers(): HasManyThrough return $this->hasManyThrough(User::class, Talk::class, 'user_id'); } + protected function duration(): Attribute + { + return Attribute::make( + get: fn () => $this->start_at->diffInHours($this->end_at), + ); + } + + protected function start(): Attribute + { + return Attribute::make( + get: fn () => $this->start_at?->format('H:i'), + ); + } + + protected function day(): Attribute + { + return Attribute::make( + get: fn () => $this->event_at?->format('d/m'), + ); + } + + protected function end(): Attribute + { + return Attribute::make( + get: fn () => $this->end_at?->format('H:i'), + ); + } + #[Scope] protected function availableHours(Builder $query, string $start, string $end): Builder { diff --git a/app-modules/events/src/Models/Talk.php b/app-modules/events/src/Models/Talk.php index c0a53583..f821c561 100644 --- a/app-modules/events/src/Models/Talk.php +++ b/app-modules/events/src/Models/Talk.php @@ -9,6 +9,7 @@ use He4rt\Tenant\Models\Tenant; use He4rt\User\Models\User; use Illuminate\Database\Eloquent\Attributes\UseFactory; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -56,6 +57,20 @@ public function tenant(): BelongsTo return $this->belongsTo(Tenant::class); } + protected function start(): Attribute + { + return Attribute::make( + get: fn () => $this->starts_at?->format('H:i'), + ); + } + + protected function end(): Attribute + { + return Attribute::make( + get: fn () => $this->ends_at?->format('H:i'), + ); + } + protected function casts(): array { return [ diff --git a/database/seeders/ThreeDotsSeeder.php b/database/seeders/ThreeDotsSeeder.php index d75a9e3b..c6cef093 100644 --- a/database/seeders/ThreeDotsSeeder.php +++ b/database/seeders/ThreeDotsSeeder.php @@ -5,6 +5,7 @@ namespace Database\Seeders; use He4rt\Events\Enums\EventTypeEnum; +use He4rt\Events\Enums\Talks\TalkStatusEnum; use He4rt\Events\Models\EventModel; use He4rt\Events\Models\Talk; use He4rt\Tenant\Models\Tenant; @@ -26,16 +27,17 @@ public function run(): void ->afterCreating(fn (Tenant $tenant) => $tenant->members()->attach($user)) ->create([ 'name' => '3 Pontos', - 'slug' => '3-pontos', + 'slug' => '3pontos', ]); $event = EventModel::factory() ->withStatus() - ->state([ - 'title' => 'Evento Da Três Pontos', + ->create([ + 'title' => 'Participe do primeiro evento presencial da 3Pontos', 'event_type' => EventTypeEnum::Workshop, 'slug' => '3-pontos-evento', - 'description' => 'Participe do primeiro evento presencial da 3pontos', + 'description' => 'Um evento híbrido de 5 horas, em parceria com a He4rt, com palestras exclusivas, networking e uma missão + social que transforma.', 'event_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 02:00:00 PM'), 'start_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 02:00:00 PM'), 'end_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 07:00:00 PM'), @@ -43,13 +45,40 @@ public function run(): void 'max_attendees' => 50, 'attendees_count' => 30, 'tenant_id' => $tenant->getKey(), - ]) - ->create(); - - Talk::factory() - ->recycle($tenant) - ->recycle($event) - ->count(4) - ->create(); + ]); + + $this->talks($tenant, $event); + } + + private function talks(Tenant $tenant, EventModel $event): void + { + $talks = [ + ['time' => '15:00', 'title' => 'Abertura e Início da Live (Twitch)'], + ['time' => '15:30', 'title' => 'Talk Juliana Gaioso (DevSec PicPay) - Tema'], + ['time' => '15:50', 'title' => 'Talk Fernanda Fagundes (Ipê) - Tema'], + ['time' => '16:10', 'title' => 'Ações social I (Cestas Básicas)'], + ['time' => '16:30', 'title' => 'Coffee Break'], + ['time' => '17:00', 'title' => 'Talk Tatiana Barros - Tema'], + ['time' => '17:20', 'title' => 'Talk Daniel Reis - Tema'], + ['time' => '17:40', 'title' => 'Ações social II (Materiais Escolares)'], + ['time' => '17:45', 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia'], + ['time' => '18:50', 'title' => 'Lançamento da comunidade 3 Pontos'], + ['time' => '19:20', 'title' => 'Hunting de Oportunidades para Comunidade'], + ['time' => '20:00', 'title' => 'Encerramento e Agradecimentos'], + ]; + + foreach ($talks as $item) { + Talk::factory() + ->recycle($tenant) + ->recycle($event) + ->create([ + 'status' => TalkStatusEnum::Accepted, + 'field_type' => 'schedule', + 'title' => $item['title'], + 'description' => $item['title'], + 'starts_at' => Date::parse($item['time']), + 'ends_at' => Date::parse($item['time']), + ]); + } } } From f7c1f6707fbb0abb59a72633ffd881a37d202eef Mon Sep 17 00:00:00 2001 From: RichardGL11 Date: Mon, 24 Nov 2025 13:30:49 -0300 Subject: [PATCH 2/4] feat(event-page): talks and speakers --- .../components/sections/speakers.blade.php | 94 +++++-------------- app-modules/events/src/Models/EventModel.php | 2 +- app-modules/user/src/Models/User.php | 9 ++ database/seeders/ThreeDotsSeeder.php | 33 ++++--- 4 files changed, 55 insertions(+), 83 deletions(-) diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php index de13e3a6..382f9a0b 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php @@ -1,5 +1,8 @@ @props([ 'event', + 'speakers' => $event->speakers->where('name', + '!=', + '3 Pontos'), ])
diff --git a/app-modules/events/src/Models/EventModel.php b/app-modules/events/src/Models/EventModel.php index 0d5d30d2..40299ddb 100644 --- a/app-modules/events/src/Models/EventModel.php +++ b/app-modules/events/src/Models/EventModel.php @@ -154,7 +154,7 @@ public function talks(): HasMany */ public function speakers(): HasManyThrough { - return $this->hasManyThrough(User::class, Talk::class, 'user_id'); + return $this->hasManyThrough(User::class, Talk::class, 'event_id', 'id', 'id', 'user_id'); } protected function duration(): Attribute diff --git a/app-modules/user/src/Models/User.php b/app-modules/user/src/Models/User.php index f27ad418..a6959540 100644 --- a/app-modules/user/src/Models/User.php +++ b/app-modules/user/src/Models/User.php @@ -9,6 +9,7 @@ use He4rt\Character\Models\Character; use He4rt\Events\Models\EventModel; use He4rt\Events\Models\Pivot\EventAttend; +use He4rt\Events\Models\Talk; use He4rt\Provider\Models\Provider; use He4rt\Tenant\Models\Concerns\InteractsWithTenants; use He4rt\User\Database\Factories\UserFactory; @@ -92,6 +93,14 @@ public function providers(): MorphMany return $this->morphMany(Provider::class, 'model'); } + /** + * @return HasMany + */ + public function talks(): HasMany + { + return $this->hasMany(Talk::class, 'user_id'); + } + /** * @return HasOne */ diff --git a/database/seeders/ThreeDotsSeeder.php b/database/seeders/ThreeDotsSeeder.php index c6cef093..987659b3 100644 --- a/database/seeders/ThreeDotsSeeder.php +++ b/database/seeders/ThreeDotsSeeder.php @@ -53,29 +53,34 @@ public function run(): void private function talks(Tenant $tenant, EventModel $event): void { $talks = [ - ['time' => '15:00', 'title' => 'Abertura e Início da Live (Twitch)'], - ['time' => '15:30', 'title' => 'Talk Juliana Gaioso (DevSec PicPay) - Tema'], - ['time' => '15:50', 'title' => 'Talk Fernanda Fagundes (Ipê) - Tema'], - ['time' => '16:10', 'title' => 'Ações social I (Cestas Básicas)'], - ['time' => '16:30', 'title' => 'Coffee Break'], - ['time' => '17:00', 'title' => 'Talk Tatiana Barros - Tema'], - ['time' => '17:20', 'title' => 'Talk Daniel Reis - Tema'], - ['time' => '17:40', 'title' => 'Ações social II (Materiais Escolares)'], - ['time' => '17:45', 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia'], - ['time' => '18:50', 'title' => 'Lançamento da comunidade 3 Pontos'], - ['time' => '19:20', 'title' => 'Hunting de Oportunidades para Comunidade'], - ['time' => '20:00', 'title' => 'Encerramento e Agradecimentos'], + ['time' => '15:00', 'speaker' => '3 Pontos', 'title' => 'Abertura e Início da Live (Twitch)', 'field_type' => 'twitch', 'description' => 'twitch'], + ['time' => '15:30', 'speaker' => 'Juliana Gaioso', 'title' => 'Talk Juliana Gaioso (DevSec PicPay) - Tema', 'field_type' => 'Devsec', 'description' => 'Por mais de quinze anos, solucionando problemas na indústria através de automação, IoT e desenvolvimento de software. Atualmente focada em solucionar problemas de software de segurança.'], + ['time' => '15:50', 'speaker' => 'Fernanda Fagundes', 'title' => 'Talk Fernanda Fagundes (Ipê) - Tema', 'field_type' => 'Lady', 'description' => 'Talk da Fefa'], + ['time' => '16:10', 'speaker' => '3 Pontos', 'title' => 'Ações social I (Cestas Básicas)', 'field_type' => '3pontos', 'description' => 'Ação Social I'], + ['time' => '16:30', 'speaker' => '3 Pontos', 'title' => 'Coffee Break', 'field_type' => '3pontos', 'description' => 'coffee break'], + ['time' => '17:00', 'speaker' => 'Tatiana Barros', 'title' => 'Talk Tatiana Barros - Tema', 'field_type' => 'Technology Evangelist', 'description' => 'Há mais de uma década unindo tecnologia, criatividade e impacto social. Evangelista de Tecnologia focada em fortalecer comunidades dev e ampliar o acesso à educação tecnológica por meio de workshops, mentorias e iniciativas premiadas.'], + ['time' => '17:20', 'speaker' => 'Daniel Reis', 'title' => 'Talk Daniel Reis - Tema', 'field_type' => 'Tech Lead & Fundador da He4rt Developers', 'description' => 'Linha de frente na criação de softwares e fortalecendo comunidades dev. DevRel focado em conteúdo técnico, live coding e educação, sempre impulsionando novos talentos. Fundador da He4rt Developers e apaixonado por ensinar, programar e construir espaços onde desenvolvedores crescem juntos.'], + ['time' => '17:40', 'speaker' => '3 Pontos', 'title' => 'Ações social II (Materiais Escolares)', 'field_type' => '3pontos', 'description' => 'Ação Social II'], + ['time' => '17:45', 'speaker' => '?????', 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia', 'field_type' => 'IA', 'description' => ' ????'], + ['time' => '18:50', 'speaker' => '3 Pontos', 'title' => 'Lançamento da comunidade 3 Pontos', 'field_type' => '3 pontos', 'description' => 'Lançamento 3 pontos'], + ['time' => '19:20', 'speaker' => '3 Pontos', 'title' => 'Hunting de Oportunidades para Comunidade', 'field_type' => '3pontos', 'description' => 'oportunidades para comunidade'], + ['time' => '20:00', 'speaker' => '3 Pontos', 'title' => 'Encerramento e Agradecimentos', 'field_type' => '3pontos', 'description' => 'Agradecimentos'], ]; foreach ($talks as $item) { + + $speaker = User::query()->firstOrCreate([ + 'name' => $item['speaker'], + ]); Talk::factory() ->recycle($tenant) ->recycle($event) + ->for($speaker, 'user') ->create([ 'status' => TalkStatusEnum::Accepted, - 'field_type' => 'schedule', + 'field_type' => $item['field_type'], 'title' => $item['title'], - 'description' => $item['title'], + 'description' => $item['description'], 'starts_at' => Date::parse($item['time']), 'ends_at' => Date::parse($item['time']), ]); From 702303449f8dddd624a0ea65f78080f1a64456d6 Mon Sep 17 00:00:00 2001 From: RichardGL11 Date: Mon, 24 Nov 2025 13:49:29 -0300 Subject: [PATCH 3/4] chore: fix some texts for speakers --- .../components/sections/speakers.blade.php | 2 +- database/seeders/ThreeDotsSeeder.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php index 382f9a0b..adecb0a4 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php @@ -2,7 +2,7 @@ 'event', 'speakers' => $event->speakers->where('name', '!=', - '3 Pontos'), + $event->slug), ])
'15:00', 'speaker' => '3 Pontos', 'title' => 'Abertura e Início da Live (Twitch)', 'field_type' => 'twitch', 'description' => 'twitch'], + ['time' => '15:00', 'speaker' => $event->slug, 'title' => 'Abertura e Início da Live (Twitch)', 'field_type' => 'twitch', 'description' => 'twitch'], ['time' => '15:30', 'speaker' => 'Juliana Gaioso', 'title' => 'Talk Juliana Gaioso (DevSec PicPay) - Tema', 'field_type' => 'Devsec', 'description' => 'Por mais de quinze anos, solucionando problemas na indústria através de automação, IoT e desenvolvimento de software. Atualmente focada em solucionar problemas de software de segurança.'], ['time' => '15:50', 'speaker' => 'Fernanda Fagundes', 'title' => 'Talk Fernanda Fagundes (Ipê) - Tema', 'field_type' => 'Lady', 'description' => 'Talk da Fefa'], - ['time' => '16:10', 'speaker' => '3 Pontos', 'title' => 'Ações social I (Cestas Básicas)', 'field_type' => '3pontos', 'description' => 'Ação Social I'], - ['time' => '16:30', 'speaker' => '3 Pontos', 'title' => 'Coffee Break', 'field_type' => '3pontos', 'description' => 'coffee break'], + ['time' => '16:10', 'speaker' => $event->slug, 'title' => 'Ações social I (Cestas Básicas)', 'field_type' => '3pontos', 'description' => 'Ação Social I'], + ['time' => '16:30', 'speaker' => $event->slug, 'title' => 'Coffee Break', 'field_type' => '3pontos', 'description' => 'coffee break'], ['time' => '17:00', 'speaker' => 'Tatiana Barros', 'title' => 'Talk Tatiana Barros - Tema', 'field_type' => 'Technology Evangelist', 'description' => 'Há mais de uma década unindo tecnologia, criatividade e impacto social. Evangelista de Tecnologia focada em fortalecer comunidades dev e ampliar o acesso à educação tecnológica por meio de workshops, mentorias e iniciativas premiadas.'], ['time' => '17:20', 'speaker' => 'Daniel Reis', 'title' => 'Talk Daniel Reis - Tema', 'field_type' => 'Tech Lead & Fundador da He4rt Developers', 'description' => 'Linha de frente na criação de softwares e fortalecendo comunidades dev. DevRel focado em conteúdo técnico, live coding e educação, sempre impulsionando novos talentos. Fundador da He4rt Developers e apaixonado por ensinar, programar e construir espaços onde desenvolvedores crescem juntos.'], - ['time' => '17:40', 'speaker' => '3 Pontos', 'title' => 'Ações social II (Materiais Escolares)', 'field_type' => '3pontos', 'description' => 'Ação Social II'], - ['time' => '17:45', 'speaker' => '?????', 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia', 'field_type' => 'IA', 'description' => ' ????'], - ['time' => '18:50', 'speaker' => '3 Pontos', 'title' => 'Lançamento da comunidade 3 Pontos', 'field_type' => '3 pontos', 'description' => 'Lançamento 3 pontos'], - ['time' => '19:20', 'speaker' => '3 Pontos', 'title' => 'Hunting de Oportunidades para Comunidade', 'field_type' => '3pontos', 'description' => 'oportunidades para comunidade'], - ['time' => '20:00', 'speaker' => '3 Pontos', 'title' => 'Encerramento e Agradecimentos', 'field_type' => '3pontos', 'description' => 'Agradecimentos'], + ['time' => '17:40', 'speaker' => $event->slug, 'title' => 'Ações social II (Materiais Escolares)', 'field_type' => '3pontos', 'description' => 'Ação Social II'], + ['time' => '17:45', 'speaker' => $event->slug, 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia', 'field_type' => 'IA', 'description' => ' ????'], + ['time' => '18:50', 'speaker' => $event->slug, 'title' => 'Lançamento da comunidade 3 Pontos', 'field_type' => '3 pontos', 'description' => 'Lançamento 3 pontos'], + ['time' => '19:20', 'speaker' => $event->slug, 'title' => 'Hunting de Oportunidades para Comunidade', 'field_type' => '3pontos', 'description' => 'oportunidades para comunidade'], + ['time' => '20:00', 'speaker' => $event->slug, 'title' => 'Encerramento e Agradecimentos', 'field_type' => '3pontos', 'description' => 'Agradecimentos'], ]; foreach ($talks as $item) { From bd9b9f7a39bcdd0c3a5d269757ed26ac9b031bce Mon Sep 17 00:00:00 2001 From: RichardGL11 Date: Mon, 24 Nov 2025 16:24:05 -0300 Subject: [PATCH 4/4] feat: implementing spatie media library for user model --- .../components/sections/speakers.blade.php | 5 +-- app-modules/events/src/Models/EventModel.php | 1 + app-modules/events/src/Models/Talk.php | 11 +++++++ app-modules/user/src/Models/User.php | 11 ++++++- .../2025_11_05_135059_create_media_table.php | 4 ++- database/seeders/ThreeDotsSeeder.php | 31 +++++++++++++------ 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php index adecb0a4..c9980e20 100644 --- a/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php +++ b/app-modules/events/resources/views/components/themes/3pontos/components/sections/speakers.blade.php @@ -35,10 +35,7 @@ class="grid grid-cols-1 gap-6 sm:grid-cols-2 sm:gap-8 lg:grid-cols-4"
- + {{ $speaker->name }} {{ $speaker->talks->first()->field_type }} diff --git a/app-modules/events/src/Models/EventModel.php b/app-modules/events/src/Models/EventModel.php index 40299ddb..1c100314 100644 --- a/app-modules/events/src/Models/EventModel.php +++ b/app-modules/events/src/Models/EventModel.php @@ -38,6 +38,7 @@ * @property int $tenant_id * @property Date $end_at * @property Date $start_at + * @property Date $event_at */ #[UseFactory(EventFactory::class)] class EventModel extends Model diff --git a/app-modules/events/src/Models/Talk.php b/app-modules/events/src/Models/Talk.php index f821c561..911773ed 100644 --- a/app-modules/events/src/Models/Talk.php +++ b/app-modules/events/src/Models/Talk.php @@ -4,6 +4,7 @@ namespace He4rt\Events\Models; +use Carbon\Carbon; use He4rt\Events\Database\Factories\TalkFactory; use He4rt\Events\Enums\Talks\TalkStatusEnum; use He4rt\Tenant\Models\Tenant; @@ -14,6 +15,16 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +/** + * @property int|string $event_id + * @property int|string $user_id + * @property TalkStatusEnum $status + * @property string $field_type + * @property string $title + * @property string $description + * @property Carbon $starts_at + * @property Carbon $ends_at + */ #[UseFactory(TalkFactory::class)] class Talk extends Model { diff --git a/app-modules/user/src/Models/User.php b/app-modules/user/src/Models/User.php index a6959540..f07d6076 100644 --- a/app-modules/user/src/Models/User.php +++ b/app-modules/user/src/Models/User.php @@ -22,6 +22,8 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Foundation\Auth\User as Authenticatable; +use Spatie\MediaLibrary\HasMedia; +use Spatie\MediaLibrary\InteractsWithMedia; /** * @property string $id @@ -30,10 +32,11 @@ * @property bool $is_donator */ #[ObservedBy(UserObserver::class)] -final class User extends Authenticatable implements HasName, HasTenants +final class User extends Authenticatable implements HasMedia, HasName, HasTenants { use HasFactory; use HasUuids; + use InteractsWithMedia; use InteractsWithTenants; protected $table = 'users'; @@ -114,6 +117,12 @@ public function getFilamentName(): string return $this->username; } + public function registerMediaCollections(): void + { + $this->addMediaCollection('avatar') + ->useDisk('public'); + } + protected static function newFactory(): UserFactory { return UserFactory::new(); diff --git a/database/migrations/2025_11_05_135059_create_media_table.php b/database/migrations/2025_11_05_135059_create_media_table.php index 402a8112..c36ddb16 100644 --- a/database/migrations/2025_11_05_135059_create_media_table.php +++ b/database/migrations/2025_11_05_135059_create_media_table.php @@ -13,7 +13,8 @@ public function up(): void Schema::create('media', function (Blueprint $table): void { $table->id(); - $table->morphs('model'); + $table->string('model_type'); + $table->string('model_id'); $table->uuid()->nullable()->unique(); $table->string('collection_name'); $table->string('name'); @@ -28,6 +29,7 @@ public function up(): void $table->json('responsive_images'); $table->unsignedInteger('order_column')->nullable()->index(); + $table->index(['model_type', 'model_id'], 'media_model_idx'); $table->nullableTimestamps(); }); } diff --git a/database/seeders/ThreeDotsSeeder.php b/database/seeders/ThreeDotsSeeder.php index babbc756..a3ace914 100644 --- a/database/seeders/ThreeDotsSeeder.php +++ b/database/seeders/ThreeDotsSeeder.php @@ -41,7 +41,7 @@ public function run(): void 'event_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 02:00:00 PM'), 'start_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 02:00:00 PM'), 'end_at' => Date::createFromFormat('m-d-Y h:i:s A', '11-29-2025 07:00:00 PM'), - 'location' => 'Avenida Paulista, 1666, São Paulo - SP', + 'location' => 'Alameda Santos, 1163 — Jardim Paulista, São Paulo — SP, 01419-002', 'max_attendees' => 50, 'attendees_count' => 30, 'tenant_id' => $tenant->getKey(), @@ -54,17 +54,24 @@ private function talks(Tenant $tenant, EventModel $event): void { $talks = [ ['time' => '15:00', 'speaker' => $event->slug, 'title' => 'Abertura e Início da Live (Twitch)', 'field_type' => 'twitch', 'description' => 'twitch'], + ['time' => '15:05', 'speaker' => 'Filipe Augusto', 'title' => '3 Pontos com Filipe', 'field_type' => 'CEO 3 Pontos', 'description' => 'A 3 Pontos é uma aceleradora financeira que conecta pessoas e empresas a diagnósticos estratégicos, soluções de investimento e tecnologia de gestão.'], + ['time' => '15:05', 'speaker' => 'Joy', 'title' => '3 Pontos com Joy', 'field_type' => 'CMO 3 Pontos', 'description' => 'A 3 Pontos é uma aceleradora financeira que conecta pessoas e empresas a diagnósticos estratégicos, soluções de investimento e tecnologia de gestão.'], + ['time' => '15:10', 'speaker' => 'Fernanda Fagundes', 'title' => 'Talk Fernanda Fagundes - (Ipê)', 'field_type' => 'Ipê', 'description' => 'Talk da Fefa'], + ['time' => '15:10', 'speaker' => $event->slug, 'title' => 'Ações social I (Cestas Básicas)', 'field_type' => '3pontos', 'description' => 'Ação Social I'], ['time' => '15:30', 'speaker' => 'Juliana Gaioso', 'title' => 'Talk Juliana Gaioso (DevSec PicPay) - Tema', 'field_type' => 'Devsec', 'description' => 'Por mais de quinze anos, solucionando problemas na indústria através de automação, IoT e desenvolvimento de software. Atualmente focada em solucionar problemas de software de segurança.'], - ['time' => '15:50', 'speaker' => 'Fernanda Fagundes', 'title' => 'Talk Fernanda Fagundes (Ipê) - Tema', 'field_type' => 'Lady', 'description' => 'Talk da Fefa'], - ['time' => '16:10', 'speaker' => $event->slug, 'title' => 'Ações social I (Cestas Básicas)', 'field_type' => '3pontos', 'description' => 'Ação Social I'], - ['time' => '16:30', 'speaker' => $event->slug, 'title' => 'Coffee Break', 'field_type' => '3pontos', 'description' => 'coffee break'], - ['time' => '17:00', 'speaker' => 'Tatiana Barros', 'title' => 'Talk Tatiana Barros - Tema', 'field_type' => 'Technology Evangelist', 'description' => 'Há mais de uma década unindo tecnologia, criatividade e impacto social. Evangelista de Tecnologia focada em fortalecer comunidades dev e ampliar o acesso à educação tecnológica por meio de workshops, mentorias e iniciativas premiadas.'], + ['time' => '15:50', 'speaker' => 'Oka', 'title' => 'Fire/ce com Oka', 'field_type' => 'Fire/ce', 'description' => 'Talk da Fire/ce'], + ['time' => '15:50', 'speaker' => 'Stefano Piucci', 'title' => 'Fire/ce com Stefano', 'field_type' => 'Diretor de Key Acc (Fire/ce)', 'description' => 'Talk da Fire/ce'], + ['time' => '16:10', 'speaker' => $event->slug, 'title' => 'Aquecimento da Nova Marca', 'field_type' => '3pontos', 'description' => 'Contexto da comunidade'], + ['time' => '16:50', 'speaker' => 'Dulce', 'title' => 'Hunting de Oportunidades para Comunidade', 'field_type' => 'Bethel', 'description' => 'Hunting de Oportunidades para Comunidade'], + ['time' => '17:10', 'speaker' => $event->slug, 'title' => 'Sorteio', 'field_type' => 'sorteio', 'description' => 'Sorteio 1.'], ['time' => '17:20', 'speaker' => 'Daniel Reis', 'title' => 'Talk Daniel Reis - Tema', 'field_type' => 'Tech Lead & Fundador da He4rt Developers', 'description' => 'Linha de frente na criação de softwares e fortalecendo comunidades dev. DevRel focado em conteúdo técnico, live coding e educação, sempre impulsionando novos talentos. Fundador da He4rt Developers e apaixonado por ensinar, programar e construir espaços onde desenvolvedores crescem juntos.'], - ['time' => '17:40', 'speaker' => $event->slug, 'title' => 'Ações social II (Materiais Escolares)', 'field_type' => '3pontos', 'description' => 'Ação Social II'], - ['time' => '17:45', 'speaker' => $event->slug, 'title' => 'Roda de Conversa com ?????????? - IA como ferramenta do dia a dia', 'field_type' => 'IA', 'description' => ' ????'], - ['time' => '18:50', 'speaker' => $event->slug, 'title' => 'Lançamento da comunidade 3 Pontos', 'field_type' => '3 pontos', 'description' => 'Lançamento 3 pontos'], - ['time' => '19:20', 'speaker' => $event->slug, 'title' => 'Hunting de Oportunidades para Comunidade', 'field_type' => '3pontos', 'description' => 'oportunidades para comunidade'], - ['time' => '20:00', 'speaker' => $event->slug, 'title' => 'Encerramento e Agradecimentos', 'field_type' => '3pontos', 'description' => 'Agradecimentos'], + ['time' => '17:40', 'speaker' => $event->slug, 'title' => 'Roda de Conversa - IA como ferramenta do dia a dia', 'field_type' => 'IA', 'description' => 'IA como ferramenta do dia a dia'], + ['time' => '17:40', 'speaker' => 'Eduardo Vogel', 'title' => 'Roda de Conversa - Eduardo Vogel', 'field_type' => 'Business Development & Strategic Partnerships/ IT Project Manager', 'description' => 'IA como ferramenta do dia a dia'], + ['time' => '17:50', 'speaker' => 'Juliano Kimura', 'title' => 'Roda de Conversa - Juliano Kimura ', 'field_type' => 'Palestrante, Creative Thinker, Transformador Digital', 'description' => 'Foi palestrante e especialista no Facebook Brasil. Eleito duas vezes Melhor profissional de redes sociais pela ABcomm Professor há 5 anos na Comschool. '], + ['time' => '18:00', 'speaker' => 'Tatiana Barros', 'title' => 'Roda de Conversa - Tatiana Barros', 'field_type' => 'Technology Evangelist', 'description' => 'Há mais de uma década unindo tecnologia, criatividade e impacto social. Evangelista de Tecnologia focada em fortalecer comunidades dev e ampliar o acesso à educação tecnológica por meio de workshops, mentorias e iniciativas premiadas.'], + ['time' => '18:10', 'speaker' => $event->slug, 'title' => 'Intervalo', 'field_type' => '3 pontos', 'description' => 'Intervalo Técnico'], + ['time' => '18:30', 'speaker' => $event->slug, 'title' => 'Lançamento da comunidade 3 Pontos', 'field_type' => '3 pontos', 'description' => 'Lançamento 3 pontos'], + ['time' => '19:00', 'speaker' => $event->slug, 'title' => 'Encerramento e Agradecimentos', 'field_type' => '3pontos', 'description' => 'Agradecimentos'], ]; foreach ($talks as $item) { @@ -72,6 +79,10 @@ private function talks(Tenant $tenant, EventModel $event): void $speaker = User::query()->firstOrCreate([ 'name' => $item['speaker'], ]); + + $speaker->addMediaFromUrl('https://github.com/danielhe4rt.png') + ->toMediaCollection('avatar'); + Talk::factory() ->recycle($tenant) ->recycle($event)