1
I need to filter all images that have a specific link, I was able to filter through the status
of the product table, but what connects the image to the product is the method image();
class Produto
:
Method image()
of the Product class:
public function image()
{
return $this->hasOne('App\ProdutoImage', 'erp_productid', 'erp_productid');
}
I need to take the amount erp_image
of ProdutoImage
and pass to the filter I tried to do it that way, but it doesn’t filter:
if(request()->has('erp_image'))
{
$produtos = Produtos::where('erp_image', request('erp_image'))
->paginate(25)
->appends('erp_image', request('erp_image'));
}
else
{
$produtos = Produtos::paginate(25);
}
In my View
added the Link
:
<a href="/products/?erp_image=http://teste.s3-website-sa-east-1.amazonaws.com/produtos/teste.jpg">
<span class="label label-primary">Sem Imagem</span>
</a>
Any suggestions?