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

 

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

© 本文著作权归作者所有。转载请联系授权,禁止商用。