drake24
848
17
General

How to Call a static Method inside a blade in Laravel 5

Posted 3 years ago by drake24

I have problem. Usually in Laravel 4 I have views / blades that will call static functions from my Helper folder which is located at app/helpers/helper.php. class Helpers{

public static function myCustomHelper(){
    return
        "Im a custom helper";
}

I can call it in my blade simple by {{ Helpers::myCustomHelper() }}. However, in Laravel 5 I get an error stating Helpers class is not found.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.