我的滤镜搜索有问题......我想从sum total_amount和unique_number获取数据......但它不起作用.....我将在Controller中显示我的函数过滤器代码.. ..
public function ifilter(Request $request)
{
$data = $request->all();
$flag = 1;
$title = 'Invoice Paid';
$master = Master_lookup::where('type' , 'LIKE' , 'order_status')->select('name','id')->where('id', '=' , 9)->orWhere('id' , '=' , 10)->orWhere('id' , '=' , 11)->orWhere('id' , '=' , 12)->orWhere('id' , '=' , 13)->orWhere('id' , '=' , 14)->get();
if (! empty($data))
{
$orders = Order::whereHas('user', function ($query) use ($data)
{
if(! empty($data['buyer']))
{
$query->where('name' , 'LIKE' , '%'.$data['buyer'].'%');
}
})->whereHas('store' , function($query) use ($data)
{
if(! empty($data['store']))
{
$query->where('name' , 'LIKE' , '%'.$data['store'].'%');
}
})->where(function($query) use($data)
{
if (! empty($data['number']))
{
$query->where('number','LIKE','%'.$data['number'].'%');
}
})->where(function($query) use($data)
{
if (! empty($data['total-amount']))
{
$query->where('total_amount', '=' , $data['total-amount'])->where('total_amount','=','total_amount+unique');
}
})->where(function($query) use($data)
{
if (! empty($data['total-transferred']))
{
$query->where('proof_of_payment', '=' , $data['total-transferred']);
}
})->where(function($query) use($data)
{
if (! empty($data['received-at']))
{
$query->whereDate('received_at' , '=' , $data['received-at']);
}
})->where(function($query) use($data)
{
if (! empty($data['request-at']))
{
$query->whereDate('request_payout_at', '=' , $data['request-at']);
}
})->whereHas('master' , function($query) use($data)
{
if (! empty($data['status']))
{
$query->where('id' , '=' , $data['status']);
}
})->where('status', '=' , 10)
->with('user')
->paginate(10);
return view('orders.invoice-paid', compact('master' , 'orders' , 'title' , 'flag'));
}
}
你可以看到我的$ data ['total-amount'] ...我想尝试总和2列...但它不起作用.....我搜索我的数据,没有任何显示...可以请帮助我......如果可以,请告诉我正确的代码......