ioven
V2EX  ›  PHP

Eloquent 如何优雅的实现 replace into?

  •  
  •   ioven · Jul 27, 2016 · 5024 views
    This topic created in 3588 days ago, the information mentioned may be changed or developed.
    $sql = 'replace into table(n1,n2,n3) VALUES (?,?,?)';
    DB::statement( $sql, array(1,2,3));
    

    重写 firstOrCreate 方法,感觉不太优雅,求教有没有更好的方法?

    环境限制, Eloquent 4.1

    1 replies    2016-07-27 22:40:36 +08:00
    jhdxr
        1
    jhdxr  
       Jul 27, 2016   ❤️ 1
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3103 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 13:51 · PVG 21:51 · LAX 06:51 · JFK 09:51
    ♥ Do have faith in what you're doing.