INIT: initial commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Modules\Profiler\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use Modules\Profiler\Middleware\Profiler;
|
||||
|
||||
class ProfilerServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
$this->alias = 'profiler';
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
$this->app->register(ProfilerEventServiceProvider::class);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
parent::register();
|
||||
|
||||
// register settings form
|
||||
$registrator = $this->app->make('registerSettingsExtension');
|
||||
$registrator->register('profiler', 'profiler::module.name', 'profiler::settings.profiler');
|
||||
|
||||
// turn on profiler for visitor area (middleware group "web")
|
||||
if (setting('useProfilerInVisitorArea', true)) {
|
||||
$this->app['router']->prependMiddlewareToGroup('web', Profiler::class);
|
||||
}
|
||||
|
||||
// use profiler also in admin?
|
||||
if (setting('useProfilerInAdmin', true)) {
|
||||
$this->app['router']->prependMiddlewareToGroup('admin', Profiler::class);
|
||||
}
|
||||
}
|
||||
|
||||
protected function setModulePath()
|
||||
{
|
||||
$this->path = __DIR__;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user