Skip to content
Advertisement

laravel write multiple where clause to filter files

I don’t know how to filter this in my laravel 9 app using eloquent.

I am having a files table and file_metadata (pivot) – where files has multiple metas:

ex: file_metadata for 3 files:

JavaScript

So files 5 ,6 ,7 have 2 metas (3 active, 6 signed). File 7 is active but not signed.

How to write the where clause to show in this case those both files (5,6) that are signed and active ?

I have tried this but is showing me also the file with id 7 (which is not signed)

JavaScript

I have also tried this:

JavaScript

Any idea how to make the conditions to get the files that are both signed and active ?

Advertisement

Answer

The final where clause is this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement