ioven
V2EX  ›  PHP

Eloquent 如何优雅的实现 replace into?

  •  
  •   ioven · Jul 27, 2016 · 5329 views
    This topic created in 3718 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   ·   Privacy   ·   Solana   ·   2306 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 06:18 · PVG 14:18 · LAX 23:18 · JFK 02:18
    ♥ Do have faith in what you're doing.