Can any one tell me why i am getting error for the following code.
public function postFormfilehandellerpre(){
$event = Input::get('event');
if($event =="Rescom Summit Bangalore 2015")
$qid1 = "3124";
$users = User::where('event','=',$event)->orderby('name')->with(array('answer'=>function($q){
$q->where('question_id','=',$qid1)->orWhere('question_id','=',$qid1+1);
}))->get();
return Redirect::to('admin/formfilehandellerpre')->with(array('liusers'=>$users,'liev'=>$event));
}
ERROR
Undefined variable: qid1
Then i tried to pass the $qid inside the function like this
$users = User::where('event','=',$event)->orderby('name')->with(array('answer'=>function($q,$qid1){
$q->where('question_id','=',$qid1)->orWhere('question_id','=',$qid1+1);
}))->get();
ERROR
Missing argument 2 for AdminController::{closure}()
'answer' => function() use($q, $qid1) {