mercredi 12 septembre 2018

How to implement nested If statement in Laravel Eloquent?

I am using laravel eloquent to fetch data from mongodb.

The scenario is, there are 3 fields:

field_1, field_2, field_3.

field_1 is mandatory while field_2 and field_3 are optional.

If there is field_3 I need to apply where clause on field_3, if there is field_2, where clause will be applied on field_2 or else where clause will be applied on field_1 by default.

Can I achieve this with Laravel 5.5 Eloquent Model??

Thanks.



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

Aucun commentaire:

Enregistrer un commentaire