File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,35 @@ public function execute(ArticleData $articleData): Article
27
27
);
28
28
}
29
29
30
+ $ user = Auth::user ();
31
+
32
+ if ($ user ->isAdmin () || $ user ->isModerator ()) {
33
+ $ articleData ->published_at = new Carbon (
34
+ time: today (),
35
+ timezone: config ('app.timezone ' )
36
+ );
37
+
38
+ $ articleData ->submitted_at = new Carbon (
39
+ time: $ articleData ->submitted_at ,
40
+ timezone: config ('app.timezone ' )
41
+ );
42
+
43
+ $ articleData ->approved_at = new Carbon (
44
+ time: today (),
45
+ timezone: config ('app.timezone ' )
46
+ );
47
+ }
48
+
30
49
// @phpstan-ignore-next-line
31
50
return Article::query ()->create ([
32
51
'title ' => $ articleData ->title ,
33
52
'slug ' => $ articleData ->slug ,
34
53
'body ' => $ articleData ->body ,
35
54
'published_at ' => $ articleData ->published_at ,
36
55
'submitted_at ' => $ articleData ->submitted_at ,
56
+ 'approved_at ' => $ articleData ->approved_at ,
37
57
'canonical_url ' => $ articleData ->canonical_url ,
38
- 'user_id ' => Auth:: id () ,
58
+ 'user_id ' => $ user -> id ,
39
59
]);
40
60
}
41
61
}
Original file line number Diff line number Diff line change @@ -18,5 +18,6 @@ public function __construct(
18
18
public ?Carbon $ published_at = null ,
19
19
public ?Carbon $ submitted_at = null ,
20
20
public ?Carbon $ declined_at = null ,
21
+ public ?Carbon $ approved_at = null ,
21
22
) {}
22
23
}
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ public static function table(Table $table): Table
102
102
103
103
return '' ;
104
104
})
105
- ->searchable ()
106
105
->sortable (),
107
106
])
108
107
->actions ([
You can’t perform that action at this time.
0 commit comments