You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
780 B
PHP
36 lines
780 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
class Tool extends Model
|
|
{
|
|
const STATUS_OPEN = 1;
|
|
|
|
protected $table = 'tab_tool';
|
|
|
|
private $configItems;
|
|
|
|
public $timestamps = false;
|
|
|
|
public static $groups = [
|
|
'sms' => ['sms_set', 'zhongwang', 'juhedata'],
|
|
];
|
|
|
|
public function get(string $name)
|
|
{
|
|
if ($this->configItems == null) {
|
|
$this->configItems = (json_decode($this->config, true) ?? []);
|
|
}
|
|
return $this->configItems[$name] ?? null;
|
|
}
|
|
|
|
public static function getActiveByGroup($group)
|
|
{
|
|
if (!isset(self::$groups[$group])) {
|
|
return null;
|
|
}
|
|
return static::where('status', self::STATUS_OPEN)->whereIn('name', self::$groups[$group])->first();
|
|
}
|
|
} |