mercredi 28 août 2019

Laravel Eloquent Query Using WHERE with AND orWhere

I am beginner in Laravel. In use in my project Laravel 5.8. I have this array:

array:4 [
  0 => 1
  1 => 3
  2 => 4
  3 => 5
]

and function:

public function getPaymentMethods(array $paymentId)
    {
            dd($paymentId);
            return PaymentSettings::where('id', '=', $paymentId)->get();
    }

It's not working because in $paymentId I have array. How can I change my code function to use with array (many where/orWhere)?

I need something like this (but in laravel eloquent):

SELECT * from payment_settings where id = 1 or id = 3 or id = 4 or id = 5.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire