File tree 3 files changed +28
-0
lines changed
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ $this->group('a')->validate(); // validates all properties in a group
49
49
$this->group(['a', 'b']); // operations can be applied to any number of groups
50
50
$this->group(['a', 'b'])->validate(); // especially handy when validating
51
51
52
+ $this->group('a')->dump();
53
+ $this->group('a')->dd();
52
54
```
53
55
54
56
## Development
Original file line number Diff line number Diff line change 7
7
use ArrayIterator ;
8
8
use IteratorAggregate ;
9
9
use Livewire \Component ;
10
+ use Illuminate \Support \Traits \Dumpable ;
10
11
11
12
class PropertyCollection implements ArrayAccess, IteratorAggregate
12
13
{
14
+ use Dumpable;
15
+
13
16
final public function __construct (
14
17
private readonly Component $ component ,
15
18
private array $ items = []
@@ -79,6 +82,23 @@ public function validate()
79
82
return $ this ->component ->validate ($ rules );
80
83
}
81
84
85
+ /*
86
+ |--------------------------------------------------------------------------
87
+ | dump & dd
88
+ |--------------------------------------------------------------------------
89
+ */
90
+ public function dump (): self
91
+ {
92
+ dump ($ this ->items );
93
+
94
+ return $ this ;
95
+ }
96
+
97
+ public function dd (): never
98
+ {
99
+ dd ($ this ->items );
100
+ }
101
+
82
102
/*
83
103
|--------------------------------------------------------------------------
84
104
| ArrayAccess/Iterator methods
Original file line number Diff line number Diff line change 2
2
3
3
use Tests \TestComponent ;
4
4
use Leuverink \PropertyAttribute \Group ;
5
+ use Leuverink \PropertyAttribute \PropertyCollection ;
5
6
6
7
use function Leuverink \PropertyAttribute \group ;
7
8
94
95
95
96
expect ($ result )->toBeArray ();
96
97
});
98
+
99
+ arch ('it is dumpable ' )
100
+ ->expect (PropertyCollection::class)
101
+ ->toHaveMethod ('dump ' )
102
+ ->toHaveMethod ('dd ' );
You can’t perform that action at this time.
0 commit comments