【发布时间】:2019-03-12 08:39:05
【问题描述】:
我试图忽略查询中特定类型的对象。有些类型的数据我禁止或删除了我不希望用户找到的数据。我的查询看起来像:
$posts = DB::table('posts')->where('content', 'like', '%' . $request['content'] . '%')
->where('isfutured', '!=', '0')
->orderByDesc('id')->get();
但现在我也不想用isfutured 的4 获取数据。我怎么做?还是我可以在 Post 模型中以某种方式阻止这些并执行我的常规 Eloquent 查询?
【问题讨论】:
标签: php mysql laravel eloquent filtering