I am new in the Laravel this is my first app. I have 2 tables:
art
-id -code -designation -prix -qte -gamme_id
gamme
-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
$data = Art::where('code','LIKE','%'.$search.'%')->paginate(5);