|
|
|
|
@ -46,7 +46,11 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$supplyDemands = SupplyDemand::where(function ($query) use ($all) {
|
|
|
|
|
$supplyDemands = SupplyDemand::with([
|
|
|
|
|
'user' => function ($query) {
|
|
|
|
|
$query->select('id', 'nickname', 'name', 'headimgurl');
|
|
|
|
|
}
|
|
|
|
|
])->where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['type'])) {
|
|
|
|
|
$query->where('type', $all['type']);
|
|
|
|
|
}
|
|
|
|
|
@ -345,7 +349,7 @@ class SupplyDemandController extends CommonController
|
|
|
|
|
$query->select('id', 'nickname', 'name', 'headimgurl');
|
|
|
|
|
}
|
|
|
|
|
])->where(function ($query) use ($all) {
|
|
|
|
|
$query->where('user_id',$this->getUserId())->orWhere('to_user_id',$this->getUserId());
|
|
|
|
|
$query->where('user_id', $this->getUserId())->orWhere('to_user_id', $this->getUserId());
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc')
|
|
|
|
|
->paginate($all['page_size'] ?? 20);
|
|
|
|
|
return $this->success(compact('dialogue'));
|
|
|
|
|
|