Files
Website/app/Models/Event.php
Shift d0493f3dd0 Convert string references to ::class
PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.
2023-05-24 21:32:58 +00:00

59 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Traits\Uuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Event extends Model
{
use HasFactory;
use Uuids;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'title',
'location',
'location_url',
'address',
'start_at',
'end_at',
'publish_at',
'status',
'registration_type',
'registration_data',
'hero',
'content',
'price',
'ages',
];
/**
* Get all of the article's attachments.
*
* @return MorphMany
*/
public function attachments()
{
return $this->morphMany(\App\Models\Attachment::class, 'attachable');
}
/**
* Get all the associated users.
*
* @return BelongsToMany
*/
public function users()
{
return $this->belongsToMany(User::class, 'event_user', 'event_id', 'user_id');
}
}