64 lines
1.0 KiB
PHP
64 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Permission\Repositories;
|
|
|
|
use App\Core\Repository;
|
|
use App\Models\Permission\Role as Model;
|
|
|
|
class RoleRepository extends Repository
|
|
{
|
|
/**
|
|
* 是否关闭缓存
|
|
*
|
|
* @var boolean
|
|
*/
|
|
protected $cacheSkip = false;
|
|
|
|
/**
|
|
* 是否开启数据转化
|
|
*
|
|
* @var bool
|
|
*/
|
|
protected $needTransform = false;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fieldSearchable = [
|
|
'id' => '=',
|
|
'name' => 'like',
|
|
'parent_id' => '=',
|
|
];
|
|
|
|
public function model()
|
|
{
|
|
return Model::class;
|
|
}
|
|
|
|
/**
|
|
* 数据格式化
|
|
*
|
|
* @param mixed $result
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function transform($model)
|
|
{
|
|
return $model;
|
|
}
|
|
|
|
/**
|
|
* 查询条件
|
|
*
|
|
* @return void
|
|
*/
|
|
public function withConditions(array $conditions = [])
|
|
{
|
|
if (isset($conditions['ids'])) {
|
|
$this->model = $this->model->whereIn('id', $conditions['ids']);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|