We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 8 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class FieldType extends BaseAttribute implements SmartAttributeInterface |
||
10 | { |
||
11 | public static function getDefault(SmartCollectionInterface $attributes) |
||
12 | { |
||
13 | if (backpack_pro() && $attributes->getAttributeValue('relation_type')) { |
||
14 | return 'relationship'; |
||
15 | } |
||
16 | |||
17 | switch ($attributes->getAttributeValue('relation_type')) { |
||
18 | case 'BelongsTo': |
||
19 | return 'select'; |
||
20 | case 'BelongsToMany': |
||
21 | case 'MorphToMany': |
||
22 | return 'select_multiple'; |
||
23 | default: |
||
24 | return 'text'; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | public static function getValidationRules(SmartCollectionInterface $attributes): array |
||
29 | { |
||
30 | return ['required']; |
||
31 | } |
||
32 | |||
33 | public static function getAttributeName(): string |
||
36 | } |
||
37 | } |
||
38 |