วันอาทิตย์ที่ 17 สิงหาคม พ.ศ. 2557

Laravel : วิธี remove the updated_at and created_at columns from the table

ปกติ แล้ว Eloquent ORM ของ  Laravel จะสร้าง field updated_at และ created_at ให้กับ table ผ่าน Model โดยอัตโนมัติ ซึ่งบางครั้งการออกแบบ table ต้องการเปลี่ยนชื่อ field ซึ่งมีวิธีที่สามารถเอา field updated_at และ created_at ออกจาก Table โดย

// app/models/User.php
class User extends Eloquent
{
    public $timestamps = false;
}

ที่มา
http://daylerees.com/codebright/eloquent

ไม่มีความคิดเห็น:

แสดงความคิดเห็น