mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-01-24 12:03:17 +00:00
- **Removed:** Unused feature and component tests to clean up the codebase. - **Added:** `RecurrenceType` enum for handling event recurrence modes. - **Introduced:** City, Country, and Meetup factories for test data generation. - **Implemented:** Migration to support recurring event fields in `meetup_events` table. - **Enhanced:** Livewire meetup events creation with recurrence validation and preview logic. - **Updated:** PHPUnit test suite configuration and composer dependencies for `pestphp/pest@v4.3`. - **Refined:** SEO configuration (`favicon`) to standardize icon format.
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\RecurrenceType;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MeetupEvent extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that aren't mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'id' => 'integer',
|
|
'meetup_id' => 'integer',
|
|
'start' => 'datetime',
|
|
'recurrence_end_date' => 'datetime',
|
|
'attendees' => 'array',
|
|
'might_attendees' => 'array',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast to enums.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $enumCasts = [
|
|
'recurrence_type' => RecurrenceType::class,
|
|
];
|
|
|
|
protected static function booted()
|
|
{
|
|
static::creating(function ($model) {
|
|
if (! $model->created_by) {
|
|
$model->created_by = auth()->id();
|
|
}
|
|
});
|
|
}
|
|
|
|
public function createdBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function meetup(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Meetup::class);
|
|
}
|
|
}
|