32 lines
622 B
PHP
32 lines
622 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class EggCollectionItem extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'eggs_count' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function collection(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EggCollection::class, 'egg_collection_id');
|
|
}
|
|
|
|
public function chicken(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Chicken::class);
|
|
}
|
|
}
|