jeudi 1 novembre 2018

Getting data from two separate models in laravel

i wanted to get data which is related to a id and i used find($id) method to get those data, now i wanna get data from two tables which having one to many relationship how can i get data which is related to same id from two table i try to this way but it wasn't worked.

enter code here

public function show($id) {

    $post=Clients::find($id);

    return view('pet.shw',['post'=>$post,'pets'=>$post->pets]);

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire