1
votes

when i run a command in laravel project :

 php artisan optimize                                                      

[Symfony\Component\Debug\Exception\FatalErrorException]  
Call to undefined function get()                         

Script php artisan optimize handling the post-update-cmd event returned with an error


[RuntimeException]  
Error Output:       

and

php artisan clear-compiled


[Symfony\Component\Debug\Exception\FatalErrorException]  
Call to undefined function get()            

and

php artisan optimize --force


[Symfony\Component\Debug\Exception\FatalErrorException]  
Call to undefined function get()  

and

{ composer update Loading composer repositories with package information Updating dependencies (including require-dev) - Removing barryvdh/laravel-ide-helper (v2.1.4) - Removing symfony/class-loader (v3.1.0) Writing lock file Generating autoload files

Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize

[Symfony\Component\Debug\Exception\FatalErrorException]  
Call to undefined function get()                         


 Script php artisan optimize handling the post-update-cmd event returned with an error


 [RuntimeException]  
Error Output:                   

}

and my composer.json is

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.2.*",
    "laravelcollective/html": "5.2.*"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "symfony/css-selector": "2.8.*|3.0.*",
    "symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},
"scripts": {
    "post-root-package-install": [
        "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist"
}

}

so, what's wrong is it,and how can i fix it? thanks?

2
May be you used get() in some serviceProvider.Parvez Rahaman

2 Answers

2
votes

You're using get() method in a wrong way somewhere in your app (model or controller). Fix it and all commands will work again.

If you want more help, please post your recently added code which uses get() method.

7
votes

This error also comes when you did an error in creating a route. Instead of Route::get(...) you may have put Route:get(...), So just check in your route or Controllers files