53 lines
982 B
PHP
53 lines
982 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Model;
|
||
|
|
|
||
|
|
use support\Model;
|
||
|
|
|
||
|
|
class Company extends Model
|
||
|
|
{
|
||
|
|
protected $table = 'company';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'name',
|
||
|
|
'feishu_app_id',
|
||
|
|
'feishu_app_secret',
|
||
|
|
'feishu_tenant_key',
|
||
|
|
'status',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'status' => 'integer',
|
||
|
|
'created_at' => 'datetime',
|
||
|
|
'updated_at' => 'datetime',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $hidden = [
|
||
|
|
'feishu_app_secret',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取启用的公司
|
||
|
|
*/
|
||
|
|
public function scopeActive($query)
|
||
|
|
{
|
||
|
|
return $query->where('status', 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 根据飞书租户Key查找
|
||
|
|
*/
|
||
|
|
public function scopeByFeishuTenantKey($query, string $tenantKey)
|
||
|
|
{
|
||
|
|
return $query->where('feishu_tenant_key', $tenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 根据飞书AppID查找
|
||
|
|
*/
|
||
|
|
public function scopeByFeishuAppId($query, string $appId)
|
||
|
|
{
|
||
|
|
return $query->where('feishu_app_id', $appId);
|
||
|
|
}
|
||
|
|
}
|