27 lines
568 B
PHP
27 lines
568 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Harim extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $guarded = [];
|
|
|
|
public function histories(): HasMany
|
|
{
|
|
return $this->hasMany(HarimHistory::class);
|
|
}
|
|
|
|
protected function primaryArea(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn($value) => json_decode($value)
|
|
);
|
|
}
|
|
}
|