I am developing a feature for an app using Laravel, and I am coming across this weird error that I can't figure out. I have the following code as a helper function to my controller, which was working just fine before I added a call to the following function:
protected function f($p){}
$cIds = $cs->select('cs.id')->get();
$cs = DB::table('cs')
->select('cs.id')
->join('pucs', 'cs.id', '=', 'pucs.c_id')
->where('pucs.p_id', '=', (string)$p->id)
->whereIn('cs.id', $cIds)->lists('cs.id');
return $cs;
}
where pucs
has a foreign key to cs
and a column called p_id
, and I only want to return rows where p_id = $p->id
. $p
is the result of a previous query, and $p->id
is an int (I think?). When I open the page on my website, I get the following error:
Missing argument 1 for Illuminate\Database\Query\Builder::lists()
Does anyone have any insight as to what might be causing this problem? My initial thought was that $p->id
was an int and that was causing the problem, so I cast it to a string using the (string)
operator, as well as trying strval($p->id)
. I'm out of ideas.
via AWeston