-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceProvider.php
More file actions
75 lines (63 loc) · 2.04 KB
/
Copy pathServiceProvider.php
File metadata and controls
75 lines (63 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace Laluciole\GdprForms;
use Laluciole\GdprForms\Widgets\Formsubmissions;
use Statamic\Providers\AddonServiceProvider;
use Statamic\Facades\CP\Nav;
use Laluciole\GdprForms\Console\Commands\GdprCheck;
use Statamic\Facades\Permission;
class ServiceProvider extends AddonServiceProvider
{
protected $routes = [
'cp' => __DIR__.'/../routes/cp.php',
'console' => __DIR__.'/../routes/console.php',
];
protected $widgets = [
Formsubmissions::class
];
protected $commands = [
GdprCheck::class
];
protected $vite = [
'input' => [
'resources/js/cp.js',
'resources/js/request.js'
],
'publicDirectory' => 'resources/dist',
];
public function bootAddon()
{
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang','general');
$this->loadJsonTranslationsFrom(__DIR__ . '/../resources/lang');
Permission::group('gdpr-forms', 'GDPR', function () {
Permission::register('gdpr-utility', function ($permission) {
$permission->label('GDPR Utility')->description("Grants access to the GDPR utility");
});
});
Nav::extend(function (\Statamic\CP\Navigation\Nav $nav) {
$nav->tools("Gestion RGPD")
->route('statamic.cp.gdpr.index')
->can('gdpr-utility')
->icon('checkmark');
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$toOverride = collect([
// Form RGPD
\Statamic\Http\Controllers\CP\Forms\FormsController::class =>
\Laluciole\GdprForms\Overrides\Http\Controllers\FormsController::class,
]);
$toOverride->each(function($classOverriding, $classToOverride) {
$this->app->bind(
$classToOverride,
$classOverriding
);
});
// $this->mergeConfigFrom(__DIR__.'/../config/gdpr.php', 'gdpr');
}
}