12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Models;
- class ProjectRole extends BaseModel
- {
- /**
- * @param $key
- * 工区负责人(work)
- * 机电负责人(machine)
- * 项目副经理(assist)
- * 项目经理(manager)
- * 管理员子账号(sub)
- * 领导账号(leader)
- * 管理员(admin)
- * @param $column
- * @return mixed
- */
- public static function getByKey($key, $column = null)
- {
- $role = self::where('key', $key)->first();
- if($column) return $role ? $role[$column] : '';
- return $role;
- }
- public function getNext($column = null, $inner = false)
- {
- $need_check = $inner ? 'need_check_inner' : 'need_check';
- $item = $this->where([
- [$need_check, '=', 1],
- ['id', '>', $this['id']]
- ])->first();
- return $column ? ($item ? $item[$column] : '') : $item;
- }
- public static function getOptions()
- {
- return self::where('id', '>', 0)->get()->toArray();
- }
- }
|