I need to filter all the images that have a specific link, I was able to filter through status
of the product table, but what binds the image to the product is the image();
method of the Produto
class:
Method image()
of class Product:
public function image()
{
return $this->hasOne('App\ProdutoImage', 'erp_productid', 'erp_productid');
}
I need to get the value erp_image
from ProdutoImage
and pass to the filter I tried to do this, but it does not 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
I added 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?