edwin Yuan
edwin Yuan

Reputation: 75

laravel Call to undefined function get()

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?

Upvotes: 3

Views: 13664

Answers (2)

Nathan Teyou
Nathan Teyou

Reputation: 2136

This error also appears if you made a mistake when creating a route. Instead of Route::get(...) you may have put Route:get(...). So just check your routes/ or app/Http/Controllers/ files.

Upvotes: 9

Alexey Mezenin
Alexey Mezenin

Reputation: 163798

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.

Upvotes: 2

Related Questions