| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | 
							- <?php
 
- namespace app\admin\model;
 
- use support\Model;
 
- /**
 
-  * 教师模型
 
-  * Class Users
 
-  * @package app\admin\model
 
-  */
 
- class LifeTeacher extends Model
 
- {
 
-     const IS_DEL_YES = 1;
 
-     const IS_DEL_NO  = 0;
 
-     const TEACHER_IS_SHOW = [
 
-         self::IS_DEL_YES => '已删除',
 
-         self::IS_DEL_NO  => '未删除'
 
-     ];
 
-     /**
 
-      * The table associated with the model.
 
-      *
 
-      * @var string
 
-      */
 
-     protected $table = 'teacher';
 
-     public $timestamps = false;
 
-     /**
 
-      * Notes:获取教师列表
 
-      * @param string $keywords
 
-      * @param int $page
 
-      * @param int $limit
 
-      * @return array
 
-      * User: ZQ
 
-      * Date: 2022/10/25
 
-      */
 
-     public static function getTeacherList(int $page, int $limit, string $keywords)
 
-     {
 
-         $list = static::select('*')
 
-             ->where(['teacher_is_del'=>static::IS_DEL_NO])
 
-             ->when($keywords != '', function ($query) use ($keywords){
 
-                 $query->where('teacher_name', 'like', '%' . $keywords . '%');
 
-             })
 
-             ->orderBy('teacher_create_time','DESC')
 
-             ->forPage($page, $limit)
 
-             ->get();
 
-         $count = static::where(['teacher_is_del'=>static::IS_DEL_NO])
 
-             ->when($keywords != '', function ($query) use ($keywords){
 
-                 $query->where('teacher_name', 'like', '%' . $keywords . '%');
 
-             })
 
-             ->count();
 
-         return [$list, $count];
 
-     }
 
-     /**
 
-      * Notes:获取所有教师
 
-      * @return array
 
-      * User: ZQ
 
-      * Date: 2022/10/14
 
-      */
 
-     public static function getTeacherAll()
 
-     {
 
-         $list = static::select(['teacher_id','teacher_name'])
 
-             ->where(['teacher_is_del'=>static::IS_DEL_NO])
 
-             ->orderBy('teacher_create_time','DESC')
 
-             ->get();
 
-         return $list;
 
-     }
 
-     /**
 
-      * Notes:获取教师名称
 
-      * @param string $account
 
-      * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
 
-      * User: ZQ
 
-      * Date: 2022/10/14
 
-      */
 
-     public static function teacherMation($admin_cinema)
 
-     {
 
-         $where = [];
 
-         $where['teacher_is_del'] = static::IS_DEL_NO;
 
-         $mation = static::where($where)
 
-             ->when($admin_cinema != '', function ($query) use ($admin_cinema){
 
-                 $query->whereIn('teacher_id', $admin_cinema);
 
-             })
 
-             ->get('teacher_name');
 
-         return $mation;
 
-     }
 
- }
 
 
  |