<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ~~~ <?php namespace App\Models\Auth; use App\Traits\SerializeListTime; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use App\Services\AdminUsersService; use Tymon\JWTAuth\Contracts\JWTSubject; /** * AdminUsersModel 管理員表 */ class AdminUsers extends Authenticatable implements JWTSubject { use Notifiable, SerializeListTime; /** * 開啟軟刪除 */ use SoftDeletes; /** * 數據表名稱 * @var string */ protected $table = "admin_users"; /** * 驗證的字段 * * @var string[] */ protected $fillable = [ 'name', 'sex', 'person_sign', 'username', 'email', 'type', 'status', 'password', 'password_modify' ]; /** * 查詢到的數據中需要被隱藏的字段 * * @var string[] */ protected $hidden = ['password']; /** * Get the identifier that will be stored in the subject claim of the JWT. * * @return mixed */ public function getJWTIdentifier() { return $this->getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } /** * @return AdminUsers */ public static function getInstance(): AdminUsers { static $models = []; $class = get_called_class(); if (!isset($models[$class])) { $models[$class] = new $class(); } return $models[$class]; } /** * 觸發器(添加) 使用觸發器在插入用戶的時候為密碼加密 */ protected static function boot() { parent::boot(); // 在創建用戶前,為用戶的密碼進行加密 static::creating(function ($model) { $model->password = AdminUsersService::getPassword($model->password); }); // 在更新用戶前,為用戶的密碼進行加密 static::updating(function ($model) { // 判斷密碼是否改變 if ($model->isDirty('password')) { $model->password = AdminUsersService::getPassword($model->password); } }); } /** * 用戶所屬的角色組 * * @return HasManyThrough */ public function roleGroups(): HasManyThrough { return $this->hasManyThrough( AdminRoleGroup::class, AdminUserHasRoleGroup::class, 'admin_id', 'id', 'id', 'group_id' ); } /** * 用戶擁有的角色 * * @return HasManyThrough */ public function roles(): HasManyThrough { return $this->hasManyThrough( AdminRole::class, AdminUserHasRole::class, 'admin_id', 'id', 'id', 'role_id' ); } /** * 關聯角色表(多對多) * * @return BelongsToMany */ public function relationRoles(): BelongsToMany { return $this->belongsToMany(AdminRole::class, (new AdminRoleMenu())->getTable()); } /** * 搜索查詢 * * @param Builder $builder * @param array $selectFields 查詢字段數組 * @param array $orderBy 排序字段數組 * @param int $pageSize 每頁數量 * @return array */ public function scopeSearch( Builder $builder, array $selectFields, array $orderBy, int $pageSize ): array { // 1:字段查詢 $builder->select($selectFields)->with(['relationRoles' => function ($query) { return $query->select(['id', 'name']); }]); // 2:排序查詢 if (!empty($orderBy)) { $orderBy['order'] = $orderBy['order'] == 'ascending' ? 'asc' : 'desc'; } else { $orderBy = ["prop" => "id", "order" => "desc"]; } $builder->orderBy($orderBy['prop'], $orderBy['order']); // 3:每頁大小查詢 $pageSize = $pageSize ?: config('admin.defaultPageSize'); // 4:分頁查詢 $data = $builder->paginate($pageSize); // 獲取列表 return $data ? $data->toArray() : []; } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看