38 lines
778 B
PHP
38 lines
778 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Event extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\EventFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'client_id',
|
|
'title',
|
|
'date',
|
|
'emotion',
|
|
'custom_color',
|
|
'gradient_preset',
|
|
'image',
|
|
'note',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'date' => 'date:Y-m-d',
|
|
'emotion' => 'decimal:3',
|
|
'gradient_preset' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|