master
cody 4 months ago
parent 160f7f2d6d
commit a6f8bc8dbc

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

Loading…
Cancel
Save