37 lines
791 B
PHP
37 lines
791 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class OsGroup extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'os_group';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'thumbnail',
|
|
'module_host_id',
|
|
'status'
|
|
];
|
|
|
|
public function host()
|
|
{
|
|
return $this->belongsTo(\App\Models\ModuleHost::class,'module_host_id','id');
|
|
}
|
|
public function os()
|
|
{
|
|
return $this->hasMany(\App\Models\Os::class);
|
|
}
|
|
public function getStatus()
|
|
{
|
|
return match ($this->attributes['status']){
|
|
1 => '<span class="badge bg-success">Active</span>',
|
|
default => '<span class="badge bg-danger">De-Active</span>'
|
|
};
|
|
}
|
|
}
|