Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 26, 2022 14:46
Embed
What would you like to do?
<?php
$builder = Producto::orderBy("descripcion")->where("id_establecimiento", "=", Auth::user()->establecimiento->id);
if ($busqueda) {
$builder->where(function ($query) use ($busqueda) {
$query->where("descripcion", "LIKE", "%$busqueda%")->orWhere("codigo_barras", "LIKE", "%$busqueda%");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment