1
|
|
|
<?php namespace VojtaSvoboda\Reservations; |
2
|
|
|
|
3
|
|
|
use Backend; |
4
|
|
|
use Illuminate\Support\Facades\Validator; |
5
|
|
|
use System\Classes\PluginBase; |
6
|
|
|
use VojtaSvoboda\Reservations\Facades\ReservationsFacade; |
7
|
|
|
use VojtaSvoboda\Reservations\Validators\ReservationsValidators; |
8
|
|
|
|
9
|
|
|
class Plugin extends PluginBase |
10
|
|
|
{ |
11
|
|
|
public function boot() |
12
|
|
|
{ |
13
|
|
|
$this->app->bind('vojtasvoboda.reservations.facade', ReservationsFacade::class); |
14
|
|
|
|
15
|
|
|
// registrate reservations validators |
16
|
|
|
Validator::resolver(function($translator, $data, $rules, $messages, $customAttributes) { |
17
|
|
|
return new ReservationsValidators($translator, $data, $rules, $messages, $customAttributes); |
18
|
|
|
}); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function registerNavigation() |
22
|
|
|
{ |
23
|
|
|
return [ |
24
|
|
|
'reservations' => [ |
25
|
|
|
'label' => 'vojtasvoboda.reservations::lang.plugin.menu_label', |
26
|
|
|
'url' => Backend::url('vojtasvoboda/reservations/reservations'), |
27
|
|
|
'icon' => 'icon-calendar-o', |
28
|
|
|
'permissions' => ['vojtasvoboda.reservations.*'], |
29
|
|
|
'order' => 500, |
30
|
|
|
'sideMenu' => [ |
31
|
|
|
'reservations' => [ |
32
|
|
|
'label' => 'vojtasvoboda.reservations::lang.reservations.menu_label', |
33
|
|
|
'url' => Backend::url('vojtasvoboda/reservations/reservations'), |
34
|
|
|
'icon' => 'icon-calendar-o', |
35
|
|
|
'permissions' => ['vojtasvoboda.reservations.reservations'], |
36
|
|
|
'order' => 100, |
37
|
|
|
], |
38
|
|
|
'statuses' => [ |
39
|
|
|
'label' => 'vojtasvoboda.reservations::lang.statuses.menu_label', |
40
|
|
|
'icon' => 'icon-star', |
41
|
|
|
'url' => Backend::url('vojtasvoboda/reservations/statuses'), |
42
|
|
|
'permissions' => ['vojtasvoboda.reservations.statuses'], |
43
|
|
|
'order' => 200, |
44
|
|
|
], |
45
|
|
|
'export' => [ |
46
|
|
|
'label' => 'vojtasvoboda.reservations::lang.export.menu_label', |
47
|
|
|
'icon' => 'icon-sign-out', |
48
|
|
|
'url' => Backend::url('vojtasvoboda/reservations/reservations/export'), |
49
|
|
|
'permissions' => ['vojtasvoboda.reservations.export'], |
50
|
|
|
'order' => 300, |
51
|
|
|
], |
52
|
|
|
], |
53
|
|
|
], |
54
|
|
|
]; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function registerComponents() |
58
|
|
|
{ |
59
|
|
|
return [ |
60
|
|
|
'VojtaSvoboda\Reservations\Components\ReservationForm' => 'reservationForm', |
61
|
|
|
]; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function registerReportWidgets() |
65
|
|
|
{ |
66
|
|
|
return [ |
67
|
|
|
'VojtaSvoboda\Reservations\ReportWidgets\Reservations' => [ |
68
|
|
|
'label' => 'vojtasvoboda.reservations::lang.reservations.widget_label', |
69
|
|
|
'context' => 'dashboard', |
70
|
|
|
], |
71
|
|
|
]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function registerMailTemplates() |
75
|
|
|
{ |
76
|
|
|
return [ |
77
|
|
|
'vojtasvoboda.reservations::mail.reservation-cs' => 'Reservation confirmation CS', |
78
|
|
|
'vojtasvoboda.reservations::mail.reservation-en' => 'Reservation confirmation EN', |
79
|
|
|
'vojtasvoboda.reservations::mail.reservation-es' => 'Reservation confirmation ES', |
80
|
|
|
'vojtasvoboda.reservations::mail.reservation-fr' => 'Reservation confirmation FR', |
81
|
|
|
'vojtasvoboda.reservations::mail.reservation-ru' => 'Reservation confirmation RU', |
82
|
|
|
'vojtasvoboda.reservations::mail.reservation-admin-cs' => 'Reservation confirmation for admin CS', |
83
|
|
|
'vojtasvoboda.reservations::mail.reservation-admin-en' => 'Reservation confirmation for admin EN', |
84
|
|
|
'vojtasvoboda.reservations::mail.reservation-admin-es' => 'Reservation confirmation for admin ES', |
85
|
|
|
'vojtasvoboda.reservations::mail.reservation-admin-fr' => 'Reservation confirmation for admin FR', |
86
|
|
|
'vojtasvoboda.reservations::mail.reservation-admin-ru' => 'Reservation confirmation for admin RU', |
87
|
|
|
]; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function registerSettings() |
91
|
|
|
{ |
92
|
|
|
return [ |
93
|
|
|
'settings' => [ |
94
|
|
|
'category' => 'vojtasvoboda.reservations::lang.plugin.category', |
95
|
|
|
'label' => 'vojtasvoboda.reservations::lang.plugin.name', |
96
|
|
|
'description' => 'vojtasvoboda.reservations::lang.settings.description', |
97
|
|
|
'icon' => 'icon-calendar-o', |
98
|
|
|
'class' => 'VojtaSvoboda\Reservations\Models\Settings', |
99
|
|
|
'order' => 100, |
100
|
|
|
], |
101
|
|
|
]; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|