|
1 | 1 | <?php |
2 | 2 |
|
3 | | -namespace Vendor\Template\Config; |
| 3 | +namespace Yuges\Groupable\Config; |
4 | 4 |
|
5 | | -class Config |
| 5 | +use Yuges\Package\Enums\KeyType; |
| 6 | +use Yuges\Groupable\Models\Group; |
| 7 | +use Illuminate\Support\Collection; |
| 8 | +use Yuges\Groupable\Models\Groupable; |
| 9 | +use Yuges\Groupable\Observers\GroupObserver; |
| 10 | +use Yuges\Groupable\Observers\GroupableObserver; |
| 11 | + |
| 12 | +class Config extends \Yuges\Package\Config\Config |
6 | 13 | { |
7 | | - /** @return class-string<Template> */ |
8 | | - public static function getTemplateClass() |
| 14 | + const string NAME = 'groupable'; |
| 15 | + |
| 16 | + public static function getGroupTable(mixed $default = null): string |
| 17 | + { |
| 18 | + return self::get('models.group.table', $default); |
| 19 | + } |
| 20 | + |
| 21 | + /** @return class-string<Group> */ |
| 22 | + public static function getGroupClass(mixed $default = null): string |
| 23 | + { |
| 24 | + return self::get('model.group.class', $default); |
| 25 | + } |
| 26 | + |
| 27 | + public static function getGroupKeyType(mixed $default = null): KeyType |
| 28 | + { |
| 29 | + return self::get('models.group.key', $default); |
| 30 | + } |
| 31 | + |
| 32 | + /** @return class-string<GroupObserver> */ |
| 33 | + public static function getGroupObserverClass(mixed $default = null): string |
| 34 | + { |
| 35 | + return self::get('models.group.observer', $default); |
| 36 | + } |
| 37 | + |
| 38 | + public static function getGroupableTable(mixed $default = null): string |
| 39 | + { |
| 40 | + return self::get('models.groupable.table', $default); |
| 41 | + } |
| 42 | + |
| 43 | + /** @return class-string<Groupable> */ |
| 44 | + public static function getGroupableClass(mixed $default = null): string |
| 45 | + { |
| 46 | + return self::get('models.groupable.class', $default); |
| 47 | + } |
| 48 | + |
| 49 | + public static function getGroupableKeyType(mixed $default = null): KeyType |
9 | 50 | { |
| 51 | + return self::get('models.groupable.key', $default); |
| 52 | + } |
10 | 53 |
|
| 54 | + /** @return Collection<array-key, class-string<Groupable>> */ |
| 55 | + public static function getGroupableAllowedClasses(mixed $default = null): Collection |
| 56 | + { |
| 57 | + return Collection::make( |
| 58 | + self::get('models.groupable.allowed.classes', $default) |
| 59 | + ); |
11 | 60 | } |
12 | 61 |
|
13 | | - # code... |
| 62 | + /** @return class-string<GroupableObserver> */ |
| 63 | + public static function getGroupableObserverClass(mixed $default = null): string |
| 64 | + { |
| 65 | + return self::get('models.Groupable.observer', $default); |
| 66 | + } |
14 | 67 | } |
0 commit comments