laravel如何判断模型中是否有指定字段

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

 

Schema::hasColumn($this->model->getTable(), 'user_id')
  • 当前日期:
  • 北京时间:
  • 时间戳:
  • 今年的第:17周
  • 我的 IP:18.223.135.69
农历
五行
冲煞
彭祖
方位
吉神
凶神
极简任务管理 help
+ 0 0 0
Task Idea Collect