Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Comforse's avatar

'BadMethodCallException' with message 'Method after does not exist.'

Hi,

I am getting the following error in my app after upgrading to laravel 5.2 from 5.1: NOTE: The error occurs under my Ubuntu Server 14.04 and the code is deployed using deploybot connected to a github account. The error does not occur on my Windows development machine.

[2016-01-01 20:08:58] local.ERROR: exception 'BadMethodCallException' with message 'Method after does not exist.' in /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:81
Stack trace:
#0 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Routing\Router->__call('after', Array)
#1 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Routing\Router->after(Object(newrelic\Laravel\AfterFilter))
#2 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#3 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#4 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(232): Illuminate\Foundation\Application->bootstrapWith(Array)
#5 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(127): Illuminate\Foundation\Http\Kernel->bootstrap()
#6 /usr/share/nginx/my_server_path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#7 /usr/share/nginx/my_server_path/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#8 {main}  

I am quite new to laravel and this is fairly fresh application.

Here's my composer:

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

Any ideas?

0 likes
7 replies
Comforse's avatar
Comforse
OP
Best Answer
Level 1

I should have read the entire stack trace. Apparently, the issue is caused by newrelic. I uninstalled the newrelic agent (for now) and the error disappeared.

2 likes
dusterio's avatar

Would be great to be able to use New Relic with Laravel 5.2 though

If anyone comes up with solution (other than disabling New Relic) – please post here!

actuallymab's avatar

I uninstalled new relic too, but I am open another solutions (+1)

Please or to participate in this conversation.