File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build Assets
2
+
3
+ on : pull_request
4
+
5
+ jobs :
6
+ build :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - uses : actions/checkout@v3
10
+
11
+ - run : composer update
12
+
13
+ - run : ./vendor/bin/pint
14
+
15
+ - run : |
16
+ git config --global user.name 'Simon Hamp'
17
+ git config --global user.email '[email protected] '
18
+ if git add * ; then
19
+ git commit -m "Code style fixes"
20
+ git push
21
+ fi
Original file line number Diff line number Diff line change
1
+ {
2
+ "preset" : " laravel" ,
3
+ "rules" : {
4
+ "statement_indentation" : true
5
+ }
6
+ }
Original file line number Diff line number Diff line change 6
6
use Illuminate \Support \Str ;
7
7
use SimonHamp \LaravelNovaCsvImport \Contracts \Modifier ;
8
8
use SimonHamp \LaravelNovaCsvImport \Modifiers \Boolean ;
9
+ use SimonHamp \LaravelNovaCsvImport \Modifiers \DefaultValue ;
9
10
use SimonHamp \LaravelNovaCsvImport \Modifiers \ExcelDate ;
10
11
use SimonHamp \LaravelNovaCsvImport \Modifiers \Hash ;
11
12
use SimonHamp \LaravelNovaCsvImport \Modifiers \Prefix ;
@@ -23,6 +24,7 @@ protected function bootHasModifiers()
23
24
// Register built-in modifiers
24
25
static ::registerModifiers (
25
26
new Boolean ,
27
+ new DefaultValue ,
26
28
new ExcelDate ,
27
29
new StrModifier ,
28
30
new Hash ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace SimonHamp \LaravelNovaCsvImport \Modifiers ;
4
+
5
+ use SimonHamp \LaravelNovaCsvImport \Contracts \Modifier ;
6
+
7
+ class DefaultValue implements Modifier
8
+ {
9
+ public function title (): string
10
+ {
11
+ return 'Default Value ' ;
12
+ }
13
+
14
+ public function description (): string
15
+ {
16
+ return 'Set a default value for the field if the CSV column is empty or missing ' ;
17
+ }
18
+
19
+ public function settings (): array
20
+ {
21
+ return [
22
+ 'string ' => [
23
+ 'type ' => 'string ' ,
24
+ 'title ' => 'Default Value ' ,
25
+ ],
26
+ ];
27
+ }
28
+
29
+ public function handle ($ value = null , array $ settings = []): string
30
+ {
31
+ return $ value === null ? $ settings ['string ' ] : $ value ;
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments