dimanche 2 avril 2017

Laravel: why does this cause error - call to undefined method?

Why calling a method with parenthesis in a template causes error, but without doesn't? How would I pass a parameter then?

Error:

Call to undefined method Illuminate\Database\Query\Builder::test()

index.blade.php

...
<p class="product-price-old"><s></s></p>
...

Product.php

...
public function getTestAttribute($value)
{
    return $value;
}
...


but if I do something like this it works fine:

index.blade.php

...
<p class="product-price-old"><s></s></p>
...

Product.php

...
public function getTestAttribute()
{
    return "123";
}
...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire