File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 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
2727 );
2828 }
2929
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+
3049 // @phpstan-ignore-next-line
3150 return Article::query ()->create ([
3251 'title ' => $ articleData ->title ,
3352 'slug ' => $ articleData ->slug ,
3453 'body ' => $ articleData ->body ,
3554 'published_at ' => $ articleData ->published_at ,
3655 'submitted_at ' => $ articleData ->submitted_at ,
56+ 'approved_at ' => $ articleData ->approved_at ,
3757 'canonical_url ' => $ articleData ->canonical_url ,
38- 'user_id ' => Auth:: id () ,
58+ 'user_id ' => $ user -> id ,
3959 ]);
4060 }
4161}
Original file line number Diff line number Diff line change @@ -18,5 +18,6 @@ public function __construct(
1818 public ?Carbon $ published_at = null ,
1919 public ?Carbon $ submitted_at = null ,
2020 public ?Carbon $ declined_at = null ,
21+ public ?Carbon $ approved_at = null ,
2122 ) {}
2223}
Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ public static function table(Table $table): Table
102102
103103 return '' ;
104104 })
105- ->searchable ()
106105 ->sortable (),
107106 ])
108107 ->actions ([
You can’t perform that action at this time.
0 commit comments