'array', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * Get the user that owns this firewall configuration. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Scope a query to only include configurations for a specific user. */ public function scopeForUser($query, int $userId) { return $query->where('user_id', $userId); } /** * Get the rules count for display. */ public function getRulesCountAttribute(): int { return is_array($this->firewall_rules) ? count($this->firewall_rules) : 0; } }