'array', 'blocked' => 'boolean', 'spend' => 'decimal:2', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * Get the budget associated with the user. */ public function budget() { return $this->belongsTo(Budget::class, 'budget_id', 'budget_id'); } /** * Get the API keys for the user. */ public function apiKeys() { return $this->hasMany(ApiKey::class, 'user_id', 'user_id'); } /** * Get the usage logs for the user. */ public function usageLogs() { return $this->hasMany(UsageLog::class, 'user_id', 'user_id'); } /** * Scope a query to only include active users. */ public function scopeActive($query) { return $query->where('blocked', false); } /** * Scope a query to only include blocked users. */ public function scopeBlocked($query) { return $query->where('blocked', true); } }