<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                --- ### 1. 樂觀鎖 > class BaseModel extends Model { /** * 樂觀鎖更新 compare and update * @return bool|int * @throws Throwable */ public function cas() { throw_if(!$this->exists, \Exception::class,['model not exists when cas']); $dirty = $this->getDirty(); //修改之后的值 //是否有更新 if(empty($dirty)){ return 0; } //判斷更新的值是否存在 $diff = array_diff(array_keys($dirty), array_keys($this->original)); throw_if(!empty($diff), \Exception::class, 'key ['.implode(',', $diff).'] not exists when cas!'); //攔截更新事件 if ($this->fireModelEvent('casing') === false) { return 0; } $query = $this->newModelQuery()->where($this->getKeyName(), $this->getKey()); //不帶 delete or query foreach ($dirty as $key => $value) { $query = $query->where($key, $this->getOriginal($key)); } $row = $query->update($dirty); if ($row > 0) { $this->syncChanges(); //同步 changes $this->fireModelEvent('cased', false); $this->syncOriginal(); //同步數據庫 } return $row; } /** * Register a casing model event with the dispatcher. * * @param Closure|string $callback * @return void */ public static function casing($callback) { static::registerModelEvent('casing', $callback); } /** * Register a cased model event with the dispatcher. * * @param Closure|string $callback * @return void */ public static function cased($callback) { static::registerModelEvent('cased', $callback); } }
                  <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>

                              哎呀哎呀视频在线观看