mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 18:48:14 -05:00
27 lines
576 B
PHP
Executable File
27 lines
576 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ServerGroup extends Model
|
|
{
|
|
protected $table = 'v2_server_group';
|
|
protected $dateFormat = 'U';
|
|
protected $casts = [
|
|
'created_at' => 'timestamp',
|
|
'updated_at' => 'timestamp'
|
|
];
|
|
|
|
public function users(): HasMany
|
|
{
|
|
return $this->hasMany(User::class, 'group_id', 'id');
|
|
}
|
|
|
|
public function servers()
|
|
{
|
|
return Server::whereJsonContains('group_ids', (string) $this->id)->get();
|
|
}
|
|
}
|