feat: permissions
This commit is contained in:
51
modules/Permissions/Models/DepartmentsModel.php
Normal file
51
modules/Permissions/Models/DepartmentsModel.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Permissions\Models;
|
||||
|
||||
use Catch\Base\CatchModel as Model;
|
||||
|
||||
/**
|
||||
* @property $id
|
||||
* @property $parent_id
|
||||
* @property $department_name
|
||||
* @property $principal
|
||||
* @property $mobile
|
||||
* @property $email
|
||||
* @property $status
|
||||
* @property $sort
|
||||
* @property $creator_id
|
||||
* @property $created_at
|
||||
* @property $updated_at
|
||||
* @property $deleted_at
|
||||
*/
|
||||
class DepartmentsModel extends Model
|
||||
{
|
||||
protected $table = 'departments';
|
||||
|
||||
protected $fillable = ['id', 'parent_id', 'department_name', 'principal', 'mobile', 'email', 'status', 'sort', 'creator_id', 'created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $fieldsInList = ['id','parent_id','department_name','status','sort','created_at'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected array $form = ['parent_id','department_name','principal','mobile','email','sort'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public array $searchable = [
|
||||
'department_name' => 'like',
|
||||
'status' => '=',
|
||||
];
|
||||
|
||||
public function getList(): mixed
|
||||
{
|
||||
return self::query()->select($this->fieldsInList)->quickSearch()->get()->toTree();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user