Beispiel #1
0
 /**
  * 更新
  */
 public function u($rq = NULL)
 {
     $this->guarded = arr_except_vals($this->guarded, ['password']);
     if (!$rq) {
         $rq = rq();
     }
     return parent::u($rq);
 }
Beispiel #2
0
 /**
  * 更新
  */
 public function u($rq = null)
 {
     $this->guarded = arr_except_vals($this->guarded, ['password']);
     if (!$rq) {
         $rq = rq();
     }
     if (isset($rq['password'])) {
         $rq['password'] = hash_password($rq['password']);
     }
     return parent::u($rq);
 }
Beispiel #3
0
 public function u($rq = null)
 {
     // 验证
     if (!rq('id')) {
         return ee(1);
     }
     $rules = $this->createRule;
     $rules['name'] = $rules['name'] . ',' . rq('id');
     $validator = Validator::make($rq, $rules, $this->messages);
     if (!$validator->passes()) {
         return ee(2, $validator->errors());
     }
     return parent::u($rq);
 }
Beispiel #4
0
 /**
  * 更新
  */
 public function u($rq = NULL)
 {
     // 代理只能修改自己
     if (he_is('agency')) {
         if (rq('id') != uid()) {
             abort(403);
         }
     }
     $this->guarded = arr_except_vals($this->guarded, ['password']);
     if (!$rq) {
         $rq = rq();
     }
     if (isset($rq['ended_at']) && $rq['ended_at'] == 'Invalid date') {
         unset($rq['ended_at']);
     }
     if (isset($rq['started_at']) && $rq['started_at'] == 'Invalid date') {
         unset($rq['started_at']);
     }
     return parent::u($rq);
 }