mercredi 21 juin 2017

function in a model that returns a boolean fails to return anything in a blade view if false

I have a function i an a model that can return either true or false.

I use this function inside a view and first thing I discovered when I called it is

that that outputs 1 instead of true if I do that inside blade file. If I do dd() then it will print true or false

Second thing that is giving me a problem is that if the value is false then nothing is printed when doing this from blade file. I need something to be printed either 1/0 or true/false

Why does boolean get converted to number inside blade files but not controllers? How can I get something printed when isDesktop returns false? Right now it prints nothing in that case.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rVIwqo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire