I am new in the Laravel this is my first app. I have 2 tables:
art
JavaScript
x
-id
-code
-designation
-prix
-qte
-gamme_id
gamme
JavaScript
-id
-type
I have a relation between them
and I want to search article by “code”
search function in the controller
I try to replace
<td>{{ $row->gamme->type }}</td>
to <td>{{ $row->gamme_id}}</td>
And it works but I don’t want to see the id of gamme:
Advertisement
Answer
Can you try this
JavaScript
$data = Art::where('code','LIKE','%'.$search.'%')->paginate(5);