Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Laravel Controllers Dynamic styles with Blade

Chris Walter
PLUS
Chris Walter
Courses Plus Student 5,196 Points

asset function in laravel - why no double colon when calling?

Why is it not required to specify the class that the asset function belongs to when it is called in laravel? Is there a way to call a function from a class without using a colon or making a new class?

if I were to make another custom function named asset wouldn't this be a problem?

Any light you could shed on this would be awesome because it really has me scratching my head.

2 Answers

Laravel Helper Functions are always available to you, no need to specify the class. The helpers.php file is included by default through the bootstrapping process

Feel free to follow the rabbit hole to learn more.

Chris Walter
PLUS
Chris Walter
Courses Plus Student 5,196 Points

Thank you for the help Hampton Paulk ! The thing that I don't understand is how if I called my own function called asset() how that would or wouldn't interfere with the bootstrapped functions? I think it has something to do with namespaces but I am having trouble connecting the dots.