lundi 22 novembre 2021

Search Multiple ID's with Multiple Rows by Eloquent

I have one table which is used to get data combination of input data.like multiple molecule(chemical combination) as one combination.

Input

$id = $required->input('search'); // array:2 [ 0 => "3" 1 => "8"]

Table 1

id refid product_id name ref_2
1 1,3,46,7 5 test 6
2 1,3,8,90 10 test1 8
3 3,8,67 14 test 4 11
4 8,699, 14 test 4 11

query

$molecule =Molecule::whereIn('ref_id',$id)->pluck('product_id');

Fetch Product, query of combination contains id's 3,8

but it is fetching id's contains 3 and 8

Is this possible to do and is there a better method of doing this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire