captainhook icon indicating copy to clipboard operation
captainhook copied to clipboard

Can't run "php artisan config:cache" because of Closure in config file

Open crash13override opened this issue 8 years ago • 2 comments
trafficstars

After I try to run "php artisan config:cache" I get an error that prevents Laravel from running completely (ReflectionException). After some debugging I found that the problem was in this part of the config file of CaptainHook

    'filter'             => function($webhook) {
        return $webhook->tenant_id == Auth::user()->currentTeam->id;
    },

The problem is that Laravel can't cache Closures, so it's throwing an error.

It would be really nice if we could pass to the filter params also a string with the Class and method to be run ("\App\SomeClass@someMethod"), just like you do for the "transformer" and the "response_callback" field.

Do you think it would be possible to make?

and thanks a lot for the amazing libraries you've built!!!

crash13override avatar May 20 '17 01:05 crash13override

DId you solve the issue?

legreco avatar Oct 30 '17 19:10 legreco

Unfortunately no. I had to keep it as a Closure and not run config:cache

crash13override avatar Nov 06 '17 10:11 crash13override