jeudi 22 novembre 2018

Laravel Query Builder Get The Same ID

enter image description here

As you can see the person_id (2) has two rows. And only the person_id is what I have that has value.

In my route I have this get_introduction/{id}. In my case $id = 2

To get that I use

$results = DB::table('intro_person')->where('person_id, $id)->get();

Now the tricky one, I want to get the the row that has similar introduction_id. In my case the person 1 and 3 has similar introduction_id

Now I want to ask if its possible to query using the previous result. So in my next query I will only need to set

select('introduction_id')->where('person_id', '!=', $id)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire