I have issue with whereNotIn
in laravel 4 , i need to get that not in from array of ids as bellow
$studAttend = StudentAttendees::select('subject_schedule_id')->distinct()->get();
$Check = SubjectSchedule::whereNotIn('id', array($studAttend))->get();
Also I tried to change my code to loop over $studAttend
as bellow
$studAttendArray = array();
foreach ($studAttend as $stdAtt)
{
$studAttendArray [] = $stdAtt ;
}
To become
$Check = SubjectSchedule::whereNotIn('id', $studAttendArray)->get();
The issue that the result of $Check
variable return null []
but when i use the following manual code the result if $Check
return the row that i need it
$Check = SubjectSchedule::whereNotIn('id', array(1,2,3,4,5,6,7 ))->get();
Note the above numbers inside the array they is the same result of $studAttend
OR $stuAttendArray
.
Any Suggestions ?