Non-static method App\Http\Helper::myFunction() should not be called statically

Created at 30-Aug-2021 , By samar

Non-static method AppHttpHelper::myFunction() should not be called statically

Hello everyone, in this post we will look at how to solve "Non-static method AppHttpHelper::myFunction() should not be called statically" in programming.

Error Non-static method App\Http\Helper::myFunction() should not be called statically occurs when you try to call the non static function as static. To remove this error you change the type of function declaration or you can change the method of calling the function
  • Change method from function myFunction() to public static function myFunction

    //Use
    public static function myFunction(){
        
    }
    //Instead of
    function myFunction(){
    }
    

    You have to change the function form function myFunction to public static function myFunction to avoid this error. Because you call this method statically (Helper::myFunction()) and you did not define function as a static function.

Back to code snippet queries related laravel

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.