Support the ongoing development of Laravel.io →
Views Blade
Last updated 2 years ago.
0

views are not suppose to be cluttered with php code

however to solve this, what you can do is define an alias in the config/app.php, add a new line in the aliases array

'Xclass' => Anamespace\Bnamespace\Xclass::class,

then you should be able to use Xclass in the view directly

Last updated 8 years ago.
0

Thanks.

Is there a common approach for this case? Maybe it is better to create global helper function?

0

depends on what you're doing.

  • formatting a date -> it's better to use a helper function.
  • get a list of user types -> better to call a static method
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ownmaster ownmaster Joined 21 Sep 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.