44 lines
873 B
PHP
44 lines
873 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\PetTypeEnum;
|
|
use App\Enums\PetGenderEnum;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Pet extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'type',
|
|
'gender',
|
|
'breed',
|
|
'weight',
|
|
'sterilized',
|
|
'birthday',
|
|
'owner_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'type' => PetTypeEnum::class,
|
|
'gender' => PetGenderEnum::class,
|
|
'weight' => 'integer',
|
|
'sterilized' => 'boolean',
|
|
'birthday' => 'date',
|
|
];
|
|
|
|
public function owner()
|
|
{
|
|
return $this->belongsTo(User::class, 'owner_id');
|
|
}
|
|
|
|
public function documents()
|
|
{
|
|
return $this->hasMany(Document::class);
|
|
}
|
|
}
|