File tree 3 files changed +11
-18
lines changed
3 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function restore(): void
24
24
25
25
public function store (): void
26
26
{
27
- if (! $ this ->storeWhen ()) {
27
+ if (! $ this ->useStore () || ! $ this -> storeWhen ()) {
28
28
return ;
29
29
}
30
30
Original file line number Diff line number Diff line change 6
6
7
7
abstract class CreateForm extends Form
8
8
{
9
- protected ?string $ model = null ;
9
+ protected static ?string $ model = null ;
10
10
11
11
public function submit (): void
12
12
{
13
- $ this ->canCreate ($ this -> model );
13
+ $ this ->canCreate (static :: modelClass () );
14
14
15
15
parent ::submit ();
16
16
}
17
17
18
- protected function set ( string $ class ): void
18
+ protected function handle ( ): void
19
19
{
20
- $ this -> canCreate ( $ class );
21
-
22
- $ this -> model = $ class ;
20
+ app ( static :: modelClass ()):: create (
21
+ $ this -> all ()
22
+ ) ;
23
23
}
24
24
25
- protected function handle (): void
25
+ protected static function modelClass (): ? string
26
26
{
27
- app ( static ::$ model):: create ( $ this -> all ()) ;
27
+ return static ::$ model ;
28
28
}
29
29
}
Original file line number Diff line number Diff line change @@ -22,19 +22,12 @@ public function delete(): void
22
22
{
23
23
$ this ->canDelete ($ this ->model );
24
24
25
- $ this ->model ->delete ();
26
- }
27
-
28
- protected function set (Model $ model ): void
29
- {
30
- $ this ->canUpdate ($ model );
31
-
32
- $ this ->model = $ model ;
25
+ $ this ->model ->deleteOrFail ();
33
26
}
34
27
35
28
protected function handle (): void
36
29
{
37
- $ this ->model ->update (
30
+ $ this ->model ->updateOrFail (
38
31
$ this ->all ()
39
32
);
40
33
}
You can’t perform that action at this time.
0 commit comments