-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.php
295 lines (255 loc) · 8.58 KB
/
extension.php
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?php
use Cartalyst\Extensions\ExtensionInterface;
use Illuminate\Foundation\Application;
return [
/*
|--------------------------------------------------------------------------
| Name
|--------------------------------------------------------------------------
|
| This is your extension name and it is only required for
| presentational purposes.
|
*/
'name' => 'Cart',
/*
|--------------------------------------------------------------------------
| Slug
|--------------------------------------------------------------------------
|
| This is your extension unique identifier and should not be changed as
| it will be recognized as a new extension.
|
| Ideally, this should match the folder structure within the extensions
| folder, but this is completely optional.
|
*/
'slug' => 'ninjaparade/cart',
/*
|--------------------------------------------------------------------------
| Author
|--------------------------------------------------------------------------
|
| Because everybody deserves credit for their work, right?
|
*/
'author' => 'Ninja',
/*
|--------------------------------------------------------------------------
| Description
|--------------------------------------------------------------------------
|
| One or two sentences describing the extension for users to view when
| they are installing the extension.
|
*/
'description' => 'Shopping cart',
/*
|--------------------------------------------------------------------------
| Version
|--------------------------------------------------------------------------
|
| Version should be a string that can be used with version_compare().
| This is how the extensions versions are compared.
|
*/
'version' => '0.1.0',
/*
|--------------------------------------------------------------------------
| Requirements
|--------------------------------------------------------------------------
|
| List here all the extensions that this extension requires to work.
| This is used in conjunction with composer, so you should put the
| same extension dependencies on your main composer.json require
| key, so that they get resolved using composer, however you
| can use without composer, at which point you'll have to
| ensure that the required extensions are available.
|
*/
'require' => [
'platform/access',
'ninjaparade/products'
],
/*
|--------------------------------------------------------------------------
| Autoload Logic
|--------------------------------------------------------------------------
|
| You can define here your extension autoloading logic, it may either
| be 'composer', 'platform' or a 'Closure'.
|
| If composer is defined, your composer.json file specifies the autoloading
| logic.
|
| If platform is defined, your extension receives convetion autoloading
| based on the Platform standards.
|
| If a Closure is defined, it should take two parameters as defined
| bellow:
|
| object \Composer\Autoload\ClassLoader $loader
| object \Illuminate\Foundation\Application $app
|
| Supported: "composer", "platform", "Closure"
|
*/
'autoload' => 'composer',
/*
|--------------------------------------------------------------------------
| Service Providers
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
*/
'providers' => [
'Ninjaparade\Cart\CartServiceProvider',
'Ninjaparade\Cart\EventsServiceProvider'
],
/*
|--------------------------------------------------------------------------
| Routes
|--------------------------------------------------------------------------
|
| Closure that is called when the extension is started. You can register
| any custom routing logic here.
|
| The closure parameters are:
|
| object \Cartalyst\Extensions\ExtensionInterface $extension
| object \Illuminate\Foundation\Application $app
|
*/
'routes' => function(ExtensionInterface $extension, Application $app)
{
Route::group(['namespace' => 'Ninjaparade\Cart\Controllers'], function()
{
Route::group(['prefix' => admin_uri().'/cart/carts', 'namespace' => 'Admin'], function()
{
Route::get('/', 'CartsController@index');
Route::post('/', 'CartsController@executeAction');
Route::get('grid', 'CartsController@grid');
Route::get('create', 'CartsController@create');
Route::post('create', 'CartsController@store');
Route::get('{id}/edit', 'CartsController@edit');
Route::post('{id}/edit', 'CartsController@update');
Route::get('{id}/delete', 'CartsController@delete');
});
Route::group(['prefix' => 'cart', 'namespace' => 'Frontend'], function()
{
Route::get('/', ['as' => 'cart.index', 'uses' => 'CartsController@index' ] );
Route::post('{id}/add/', ['as' => 'cart.add', 'uses' => 'CartsController@add' ] );
Route::post('{id}/remove/', ['as' => 'cart.remove', 'uses' => 'CartsController@remove' ] );
Route::post('remove/item', ['as' => 'cart.remove_get', 'uses' => 'CartsController@remove_get' ] );
Route::post('{id}/update/', ['as' => 'cart.update', 'uses' => 'CartsController@update_cart'] );
Route::post('update', ['as' => 'cart.cart_update', 'uses' => 'CartsController@update'] );
Route::get( 'empty', ['as' => 'cart.destroy', 'uses' => 'CartsController@destroy' ] );
Route::post( '/', ['as' => 'cart.get_cart', 'uses' => 'CartsController@getCart' ] );
Route::get('/get/modal', ['as' => 'cart.get_modal', 'uses' => 'CartsController@getCartModal']);
});
});
},
/*
|--------------------------------------------------------------------------
| Database Seeds
|--------------------------------------------------------------------------
|
| Platform provides a very simple way to seed your database with test
| data using seed classes. All seed classes should be stored on the
| `database/seeds` directory within your extension folder.
|
| The order you register your seed classes on the array below
| matters, as they will be ran in the exact same order.
|
| The seeds array should follow the following structure:
|
| Vendor\Namespace\Database\Seeds\FooSeeder
| Vendor\Namespace\Database\Seeds\BarSeeder
|
*/
'seeds' => [
],
/*
|--------------------------------------------------------------------------
| Permissions
|--------------------------------------------------------------------------
|
| List of permissions this extension has. These are shown in the user
| management area to build a graphical interface where permissions
| may be selected.
|
| The admin controllers state that permissions should follow the following
| structure:
|
| Vendor\Namespace\Controller@method
|
| For example:
|
| Platform\Users\Controllers\Admin\UsersController@index
|
| These are automatically generated for controller routes however you are
| free to add your own permissions and check against them at any time.
|
| When writing permissions, if you put a 'key' => 'value' pair, the 'value'
| will be the label for the permission which is displayed when editing
| permissions.
|
*/
'permissions' => function()
{
return [
];
},
/*
|--------------------------------------------------------------------------
| Widgets
|--------------------------------------------------------------------------
|
| Closure that is called when the extension is started. You can register
| all your custom widgets here. Of course, Platform will guess the
| widget class for you, this is just for custom widgets or if you
| do not wish to make a new class for a very small widget.
|
*/
'widgets' => function()
{
},
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Register any settings for your extension. You can also configure
| the namespace and group that a setting belongs to.
|
*/
'settings' => function()
{
},
/*
|--------------------------------------------------------------------------
| Menus
|--------------------------------------------------------------------------
|
| You may specify the default various menu hierarchy for your extension.
| You can provide a recursive array of menu children and their children.
| These will be created upon installation, synchronized upon upgrading
| and removed upon uninstallation.
|
| Menu children are automatically put at the end of the menu for extensions
| installed through the Operations extension.
|
| The default order (for extensions installed initially) can be
| found by editing app/config/platform.php.
|
*/
'menus' => [
],
];