mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-06 20:50:01 +00:00
1. 继续修改表表关系,与关联字段的限制; 2. 通过表表关系,简化一部分代码,自动让Laravel建立关联; 3. 拆分验证 与 优化数据创建与修改的获取数据操作; 4. 修改部分无意义的数据名称;
31 lines
610 B
PHP
31 lines
610 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 审计规则分组.
|
|
*/
|
|
class RuleGroup extends Model
|
|
{
|
|
protected $table = 'rule_group';
|
|
protected $guarded = [];
|
|
|
|
public function getTypeLabelAttribute(): string
|
|
{
|
|
if ($this->attributes['type']) {
|
|
$type_label = '<span class="badge badge-danger">阻 断</span>';
|
|
} else {
|
|
$type_label = '<span class="badge badge-primary">放 行</span>';
|
|
}
|
|
|
|
return $type_label;
|
|
}
|
|
|
|
public function rules()
|
|
{
|
|
return $this->belongsToMany(Rule::class);
|
|
}
|
|
}
|