A
A
ag0332020-06-02 21:29:19
Laravel
ag033, 2020-06-02 21:29:19

How to make a selection from the database by field - array in Laravel?

There is a project on Laravel. You need to make a query on the field, which is an array of numbers. That is, I pass 1 number and it is necessary to display all models - records from the database in the field (which is an array) has this number.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-06-04
@Fragster

Use a field to store json , then you can search by content without any problems. Another thing is that this is no longer suitable for more or less serious workloads, and you need to make either a bit mask (if there are not many possible values, up to 64) (or its counterpart with set named values ), or a joined table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question