File tree Expand file tree Collapse file tree 1 file changed +37
-31
lines changed Expand file tree Collapse file tree 1 file changed +37
-31
lines changed Original file line number Diff line number Diff line change @@ -18,50 +18,56 @@ trait SquishAttributesTrait
18
18
/**
19
19
* The attributes that are mass should squish.
20
20
*
21
- * @var string[]
21
+ * @retrun string[]
22
22
*/
23
- protected array $ squishAttributes = [
24
- 'city ' ,
25
- 'company ' ,
26
- 'country ' ,
27
- 'department ' ,
28
- 'first_name ' ,
29
- 'firstname ' ,
30
- 'full_name ' ,
31
- 'headline ' ,
32
- 'house_number ' ,
33
- 'industry ' ,
34
- 'label ' ,
35
- 'last_name ' ,
36
- 'lastname ' ,
37
- 'name ' ,
38
- 'note ' ,
39
- 'phone ' ,
40
- 'position ' ,
41
- 'postal_code ' ,
42
- 'salutation ' ,
43
- 'state ' ,
44
- 'street ' ,
45
- 'street_name ' ,
46
- 'street_number ' ,
47
- 'title ' ,
48
- 'zip ' ,
49
- ];
23
+ protected function squishAttributes (): array
24
+ {
25
+ return [
26
+ 'city ' ,
27
+ 'company ' ,
28
+ 'country ' ,
29
+ 'department ' ,
30
+ 'first_name ' ,
31
+ 'firstname ' ,
32
+ 'full_name ' ,
33
+ 'headline ' ,
34
+ 'house_number ' ,
35
+ 'industry ' ,
36
+ 'label ' ,
37
+ 'last_name ' ,
38
+ 'lastname ' ,
39
+ 'name ' ,
40
+ 'note ' ,
41
+ 'phone ' ,
42
+ 'position ' ,
43
+ 'postal_code ' ,
44
+ 'salutation ' ,
45
+ 'state ' ,
46
+ 'street ' ,
47
+ 'street_name ' ,
48
+ 'street_number ' ,
49
+ 'title ' ,
50
+ 'zip ' ,
51
+ ];
52
+ }
50
53
51
54
/**
52
55
* Additional attributes that are mass should squish.
53
56
*
54
- * @var string[]
57
+ * @retrun string[]
55
58
*/
56
- protected array $ additionalSquishAttributes = [];
59
+ protected function additionalSquishAttributes (): array
60
+ {
61
+ return [];
62
+ }
57
63
58
64
/**
59
65
* Bootstrap the trait.
60
66
*/
61
67
public static function bootHasSlugTrait (): void
62
68
{
63
69
static ::saving (function (Model $ model ) {
64
- $ attributes = array_merge ($ this ->squishAttributes , $ this ->additionalSquishAttributes );
70
+ $ attributes = array_merge ($ this ->squishAttributes () , $ this ->additionalSquishAttributes () );
65
71
foreach ($ attributes as $ attribute ) {
66
72
if (! empty ($ model ->{$ attribute }) && is_string ($ model ->{$ attribute })) {
67
73
$ model ->{$ attribute } = Str::squish ($ model ->{$ attribute });
You can’t perform that action at this time.
0 commit comments