Laravel雄辩:同一列中的多个where()无效
在我的数据库中,我有一列“publish”,它的值是“new”、“pending”、“running”和“paused”。 我想同时查询“挂起”和“运行”。我使用这个代码,但它不起作用Laravel雄辩:同一列中的多个where()无效,laravel,Laravel,在我的数据库中,我有一列“publish”,它的值是“new”、“pending”、“running”和“paused”。 我想同时查询“挂起”和“运行”。我使用这个代码,但它不起作用 $q_editpost = Menu::select('id', 'bcrumb', 'heading', 'content_id', 'content_type') ->where('publish', 'pending') ->where('publish', 'r
$q_editpost = Menu::select('id', 'bcrumb', 'heading', 'content_id', 'content_type')
->where('publish', 'pending')
->where('publish', 'running')
->get();
我需要帮助 在许多地方使用where
$q_editpost = Menu::select('id', 'bcrumb', 'heading', 'content_id', 'content_type')
->whereIn('publish', ['pending', 'running'])
->get();
有两种选择,但速度应该更快 (一) (二)
$q_editpost = Menu::select('id', 'bcrumb', 'heading', 'content_id', 'content_type')
->whereIn('publish', ['pending', 'running'])
->get();
$q_editpost = Menu::select('id', 'bcrumb', 'heading', 'content_id', 'content_type')
->where('publish', 'pending')
->orWhere('publish', 'running')
->get();