where('user_id', $user_id)->first(); if(!$model){ $model = new UserSecretPassword(); $model->user_id = $user_id; } $model->secret_password = password_hash($auth_password,PASSWORD_DEFAULT); $model->status= SECRET_PASSWORD_STATUS::BIND; $model->last_check_at =Carbon::now(); $model->save(); return true; } }