0
Since I have this data in a file I see no reason to make a request in the database.
Example of my curly code:
$produtos = Cache::rememberForever('produtos', function () {
return DB::table('produtos')
->get();
});
$produtos = \Cache::get('produtos');
Example of my code searching the database data:
$produtos = Produto::where('titulo', 'like', '%'.Input::get('texto').'%')
->orWhere('descricao', 'like', '%'.Input::get('texto').'%')
->get();
I tried to do something like this:
$produtos = \Cache::get('produtos')->where('titulo', 'like', '%'.Input::get('texto').'%');
but without success, someone would have a suggestion how to proceed, I appreciate any help :).
I had already come across this post however and I thought it would not be so interesting because create a new cache every query your tip to change my approach with Laravel Scout seems to me to be the solution to my problem, Thanks Vinicius Lourenço :).
– jardel frank