44 lines
944 B
PHP
44 lines
944 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\{BelongsTo, HasMany, BelongsToMany};
|
|
|
|
class Event extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'events';
|
|
protected $guarded = [];
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
'name' => 'array',
|
|
'description' => 'array',
|
|
'settings' => 'array',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
public function tenant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Tenant::class);
|
|
}
|
|
|
|
public function photos(): HasMany
|
|
{
|
|
return $this->hasMany(Photo::class);
|
|
}
|
|
|
|
public function taskCollections(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(
|
|
TaskCollection::class,
|
|
'event_task_collection',
|
|
'event_id',
|
|
'task_collection_id'
|
|
);
|
|
}
|
|
}
|
|
|