Laravel4: Calls to Config::get() return empty values

I’ve made one mistake developing my service provider. Here it is:

 

class AuthorizationServiceProvider extends ServiceProvider
{
 
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;
 
    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fractalizer/authorization', 'frauth');
    }
 
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(
            'fractalizer.authorization',
            function () {
                return new Manager();
            }
        );
 
        \Route::filter(\Config::get('frauth::aliases.role_filter_name'), '\Fractalizer\Authorization\Filter@hasRole');
    }
}

 

 

If you make even a single c all to Config::get() inside register() method of your service provider, all the next calls to your configuration namespace will return empty data. The correct way to do things is like this:

class AuthorizationServiceProvider extends ServiceProvider
{
 
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;
 
    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fractalizer/authorization', 'frauth');
        \Route::filter(\Config::get('frauth::aliases.role_filter_name'), '\Fractalizer\Authorization\Filter@hasRole');
    }
 
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(
            'fractalizer.authorization',
            function () {
                return new Manager();
            }
        );
    }
}

E.g. move all the calls to Config into boot() method.

XenForo Addon: timer for specific thread or post deletion

Information

Addon allows members of specific usergroups to schedule post or thread deletion on forum.

 

Features

  • Permissions: per-forum or per-usergroup
  • Date periods are completely customizable (PHP’s DateInterval syntax is used)
  • You can edit deletion or cancel it from any edit window in XenForo including quick edit
  • Actual deletion is done by XenForo’s cron
  • When thread is displayed, posts scheduled for deletion are marked with a small icon and descriptive text