php - how to check one field with two values in laravel 4.2 -


$input = input::all();   $user = user::where(function($q) {           $q->where('email', $input['email'] )             ->orwhere('email', $input['emails'][0]['value'] );       })       ->first();     print_r($user);die; 

always says undefined variable: input best way compare email 2 values please guide

add use($input) pass $input variable closure scope:

user::where(function ($q) use ($input) { 

closures may inherit variables parent scope. such variables must passed use language construct.

http://php.net/manual/en/functions.anonymous.php


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -