Laravel helper function base_path () not working

I am accessing the Laravel helper function base_path () in the model class. I am running Laravel 4.1.23

I get the following error:

    PHP Fatal error:  Call to a member function make() on a non-object in /Applications/mampstack-5.4.23-0/frameworks/laravel/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 492

It is strange that I tested the function call in phpunit and it works fine. Any help would be appreciated.

My project has the following dependencies:

"require": {
        "laravel/framework": "4.1.*",
        "cpliakas/git-wrapper": "1.1.*",
        "rmccue/requests": "v1.6.0",
        "phpseclib/phpseclib": "0.3.*"
    }
+4
source share
1 answer

Laravel tells you that it cannot execute make () on a non-object. If this is a line:

 app()->make('path.base').($path ? '/'.$path : $path);

The function return value is not an object

 app()

It may have been overrated by one of your packages or by your own helpers. This is the code that creates this function:

if ( ! function_exists('app'))
{
    /**
     * Get the root Facade application instance.
     *
     * @param  string  $make
     * @return mixed
     */
    function app($make = null)
    {
        if ( ! is_null($make))
        {
            return app()->make($make);
        }

        return Illuminate\Support\Facades\Facade::getFacadeApplication();
    }
}

, Laravel , . :

var_dump( app() );

, , .

object(Illuminate\Foundation\Application)[2]
  protected 'booted' => boolean true
  protected 'bootingCallbacks' => 
    array (size=0)

Illuminate\Foundation\Application, , app(), .

0

Source: https://habr.com/ru/post/1531672/


All Articles