mirror of
https://github.com/tiennm99/coolify.git
synced 2026-06-21 13:41:21 +00:00
9f46586d4a
Replace $guarded usage with explicit $fillable arrays across all models. Sync fillable definitions with current database schema and add tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
851 B
PHP
44 lines
851 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class CloudProviderToken extends BaseModel
|
|
{
|
|
protected $fillable = [
|
|
'provider',
|
|
'token',
|
|
'name',
|
|
];
|
|
|
|
protected $casts = [
|
|
'token' => 'encrypted',
|
|
];
|
|
|
|
public function team()
|
|
{
|
|
return $this->belongsTo(Team::class);
|
|
}
|
|
|
|
public function servers()
|
|
{
|
|
return $this->hasMany(Server::class);
|
|
}
|
|
|
|
public function hasServers(): bool
|
|
{
|
|
return $this->servers()->exists();
|
|
}
|
|
|
|
public static function ownedByCurrentTeam(array $select = ['*'])
|
|
{
|
|
$selectArray = collect($select)->concat(['id']);
|
|
|
|
return self::whereTeamId(currentTeam()->id)->select($selectArray->all());
|
|
}
|
|
|
|
public function scopeForProvider($query, string $provider)
|
|
{
|
|
return $query->where('provider', $provider);
|
|
}
|
|
}
|