'int', 'created_by' => 'int', 'is_active' => 'bool', 'default_items' => 'array', ]; public function branch(): BelongsTo { return $this->belongsTo(Branch::class, 'branch_id'); } public function createdBy(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public function scopeActive(Builder $query): Builder { return $query->where('is_active', true); } public function scopeForBranch(Builder $query, ?int $branchId): Builder { if ($branchId === null) { return $query; } return $query->where(function (Builder $q) use ($branchId) { $q->whereNull('branch_id')->orWhere('branch_id', $branchId); }); } }