how to check one field with two values in laravel 4.2

前端 未结 2 1510
终归单人心
终归单人心 2020-12-07 05:00
$input = Input::all();


$user = User::where(function($q) {
          $q->where(\'email\', $input[\'email\'] )
            ->orWhere(\'email\', $input[\'emails         


        
2条回答
  •  广开言路
    2020-12-07 06:02

    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']

提交回复
热议问题