How to exclude certains columns while using eloquent

前端 未结 8 1275
梦谈多话
梦谈多话 2020-12-02 21:59

When I\'m using eloquent, I can use the \"where\" method then the method \'get\' to fill an object containing what I\'ve selected in my database. I mean:

$us         


        
8条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 22:55

    you can use hidden array like this:

    class Promotion extends Model
    {
        protected $table = 'promotion';
        protected $hidden = array('id');
    }
    

提交回复
热议问题