I'm building a small application in Laravel 5.4
where I'm having following query:
$user = User::find(1);
$tasks = $user->tasks;
$tasks->count = $tasks->count();
$tasks->completedCount = $tasks->where('status', '=', 'Closed')->count();
$tasks->investorCount = $tasks->where('task_id', '=', 'Investor Targets')->count();
$tasks->investorCompletedCount = $tasks->where([
['task_id', '=', 'Investor Targets'],
['status', '=', 'Closed'],
])->get()->count();
$tasks->researchCount = $tasks->where('task_id', '=', 'Research Targets')->count();
$tasks->researchCompletedCount = $tasks->where([
['task_id', '=', 'Research Targets'],
['status', '=', 'Closed'],
])->get()->count();
dd($tasks);
I'm getting following error;
Missing argument 2 for Illuminate\Support\Collection::where()
In the line
$tasks->investorCompletedCount = $tasks->where([
['task_id', '=', 'Investor Targets'],
['status', '=', 'Closed'],
])->get()->count();
My syntax is also correct, I don't know from where this problem is coming. Help me out in this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire