Level 41
YOu need to actually get the results
$arr['accounts'] = Account::where('th_emp_id', auth()->user()->id)->where('th_pay_status', 0)->orderBy('th_tran_no','desc')->get();
Now you just have eloquent query
Hi,
The below code working but when I add some condition it is showing error
Working without any condition
$arr['accounts'] = Account::all();
If I add any condition then it is showing below error
$arr['accounts'] = Account::where('th_emp_id', auth()->user()->id)->where('th_pay_status', 0)->orderBy('th_tran_no','desc');
Error
Facade\Ignition\Exceptions\ViewException
count(): Parameter must be an array or an object that implements Countable (View: C:\laragon\www\ready\resources\views\admin\accounts\index.blade.php)
and If I add pagination with condition then it is working but I have dynamic row display option so I can not use any fixed pagination like pagination(10).
and I am using @if(count($accounts)) in my view page
Any one please help me.
Thank you
YOu need to actually get the results
$arr['accounts'] = Account::where('th_emp_id', auth()->user()->id)->where('th_pay_status', 0)->orderBy('th_tran_no','desc')->get();
Now you just have eloquent query
Please or to participate in this conversation.