feat: add all Eloquent models with relationships

This commit is contained in:
2026-04-03 04:07:39 +07:00
parent c9efe30584
commit 401aa30ce8
13 changed files with 315 additions and 14 deletions
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Approval extends Model
{
protected $fillable = ['model_type', 'model_id', 'required_approvals', 'status'];
public function items(): HasMany
{
return $this->hasMany(ApprovalItem::class);
}
public function approvable()
{
return $this->morphTo(__FUNCTION__, 'model_type', 'model_id');
}
}