jeudi 29 mars 2018

Matching Two Columns Query and Date [Laravel]

I need to search up a person based on their last name and partner last name. I need it to search input on both database columns.

The columns are

$users = Users::where(function($q) use($request) {
                    $q->where('sp1LName', $request->lastName)
                      ->orWhere('sp2LName', $request->lastName);
                  })->where(function($x) use($request){
                      $x->where('sp1LName', $request->partnerLastName)
                        ->orWhere('sp2LName', $request->partnerLastName);
                  })->where('signUpDate', Carbon::parse($request->date)->format('Y-m-d'))
                  ->get();


select * from `users` where (`sp1LName` = ? or `sp2LName` = ?) and (`sp1LName` = ? or `sp2LName` = ?) and `signUpDate` = ? and `users`.`deleted_at

I keep on getting 0 results found when I input this.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Gmy5Ek
via IFTTT

Aucun commentaire:

Enregistrer un commentaire