比如,需要判断模型中是否有user_id字段,用以下方法即可。

 

Schema::hasColumn($this->model->getTable(), 'user_id')