$input = Input::all();
$user = User::where(function($q) {
$q->where(\'email\', $input[\'email\'] )
->orWhere(\'email\', $input[\'emails
Add use($input)
to pass the $input
variable to the closure scope:
User::where(function ($q) use ($input) {
Closures may also inherit variables from the parent scope. Any such variables must be passed to the
use
language construct.
http://php.net/manual/en/functions.anonymous.php
User::where(function($q) use ($input) {
$q->where('email', $input['emails'][0]['value']);
if (array_key_exists('email', $input)) {
$q->orWhere('email', $input['emails'][0]['value']);
}
})
but make sure that you always have this value $input['emails'][0]['value']