D
D
Dmitry Kuznetsov2018-02-20 08:49:25
Laravel
Dmitry Kuznetsov, 2018-02-20 08:49:25

Getting relations by array, how to do?

Good afternoon. There was a situation in which from one table, in which there is a json array, to get all the data that matches the array from another table.
First table (main) blogs :

id_blogs
tags_blogs - json array - {"1", "2", "3" etc}

The second table is tags , from which you need to get all matches from the tags_blogs array:
id_tags
name_tags

Is it possible to do it, if so, how? Thank you in advance!
PS: I'm using Laravel 5.6.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UksusoFF, 2018-02-20
@UksusoFF

Is it necessary to store in json? It is easier to store tags in an intermediate table and use the hasMany relationship

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question