That's because the variable is outside its scope.
From PHP: http://php.net/manual/en/functions.anonymous.php
Closures may also inherit variables from the parent scope. Any such variables must be passed to the use language construct.
To fix it, try this (notice that I added use ($user_id)
:
public function scopeRemoveTrash($query, $user_id)
{
Log::info($user_id); //LINE 52
return $query->whereNotIn('acts.id', function($removed) use ($user_id) {
$removed->select('act_id')->from('trial_acts')->where('user_id', '=', $user_id)->get();
});
}
Thanks thomastkim
Thant was very fast :) Woked perfect.
Much appreciated, Bookmarked the link also.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community