mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -18,14 +18,16 @@
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property User $user
|
||||
* @property Collection<Server> $servers
|
||||
* @property Collection<User> $users
|
||||
* @property Collection<NotificationChannel> $notificationChannels
|
||||
* @property Collection<SourceControl> $sourceControls
|
||||
* @property Collection<int, Server> $servers
|
||||
* @property Collection<int, User> $users
|
||||
* @property Collection<int, NotificationChannel> $notificationChannels
|
||||
* @property Collection<int, SourceControl> $sourceControls
|
||||
*/
|
||||
class Project extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\ProjectFactory> */
|
||||
use HasFactory;
|
||||
|
||||
use HasTimezoneTimestamps;
|
||||
|
||||
protected $fillable = [
|
||||
@ -37,38 +39,57 @@ public static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function (Project $project) {
|
||||
$project->servers()->each(function (Server $server) {
|
||||
static::deleting(function (Project $project): void {
|
||||
$project->servers()->each(function ($server): void {
|
||||
/** @var Server $server */
|
||||
$server->delete();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, covariant $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<Server, covariant $this>
|
||||
*/
|
||||
public function servers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Server::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<NotificationChannel, covariant $this>
|
||||
*/
|
||||
public function notificationChannels(): HasMany
|
||||
{
|
||||
return $this->hasMany(NotificationChannel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsToMany<User, covariant $this>
|
||||
*/
|
||||
public function users(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'user_project')->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<SourceControl, covariant $this>
|
||||
*/
|
||||
public function sourceControls(): HasMany
|
||||
{
|
||||
return $this->hasMany(SourceControl::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<Tag, covariant $this>
|
||||
*/
|
||||
public function tags(): HasMany
|
||||
{
|
||||
return $this->hasMany(Tag::class);
|
||||
|
Reference in New Issue
Block a user