master
cody 4 months ago
parent 160f7f2d6d
commit a6f8bc8dbc

@ -48,17 +48,16 @@ class SupplyDemandController extends CommonController
public function index()
{
$all = request()->all();
$status = request('status', 1);
$supplyDemands = SupplyDemand::with([
'user' => function ($query) {
$query->select('id', 'nickname', 'name', 'headimgurl', 'username');
}
])->where(function ($query) use ($all) {
])->where(function ($query) use ($all, $status) {
$query->where('status', $status);
if (isset($all['type'])) {
$query->where('type', $all['type']);
}
if (isset($all['status'])) {
$query->where('status', $all['status']);
}
if (isset($all['keyword'])) {
$query->where('content', 'like', '%' . $all['keyword'] . '%');
}

Loading…
Cancel
Save