-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProvider.php
More file actions
29 lines (22 loc) · 1.04 KB
/
Copy pathProvider.php
File metadata and controls
29 lines (22 loc) · 1.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
<?php
/**
* Provides everything needed for the Extension
*/
$config = file_get_contents(__DIR__.'/gp247.json');
$config = json_decode($config, true);
$extensionPath = $config['configGroup'].'/'.$config['configKey'];
$this->loadTranslationsFrom(__DIR__.'/Lang', $extensionPath);
if (gp247_extension_check_active($config['configGroup'], $config['configKey'])) {
$this->loadViewsFrom(__DIR__.'/Views', $extensionPath);
if (file_exists(__DIR__.'/config.php')) {
$this->mergeConfigFrom(__DIR__.'/config.php', $extensionPath);
}
if (file_exists(__DIR__.'/function.php')) {
require_once __DIR__.'/function.php';
}
\Illuminate\Support\Facades\Validator::extend('discount_unique', function ($attribute, $value, $parameters, $validator) {
$disountId = $parameters[0] ?? '';
return (new \App\GP247\Plugins\ShopDiscount\Models\ShopDiscount)
->checkDiscountValidationAdmin(type: 'code', fieldValue: $value, discountId: $disountId, storeId: session('adminStoreId'));
});
}