I would like to know about the efficiency / performance of using Laravel's new Conditional Statements when()
that comes in the Query Builder functions.
Are they more efficient than a simple variable condition?
Example: i am filtering results with some radio and checkboxes, and they will provide many conditionals, i would like to know the most efficient way of applying them:
Simple conditional:
if($request->has('sale')) $query = $query->sale();
Laravel Conditional statement:
query->when($request->has('sale'), function ($query){
return $query->sale();
})
Thanks in advance, cheers.
Docs: http://ift.tt/1rTRTqH
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2an6938
via IFTTT
Aucun commentaire:
Enregistrer un commentaire