Skip to content

Commit

Permalink
feat: added button for publishing the collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramkanakam87 committed May 10, 2024
1 parent 6130df4 commit 98d3ba4
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ public function table(Table $table): Table
->action(function () {
Artisan::call('entries:process');
}),
Action::make('publish')
->hidden(function () {
return $this->ownerRecord->molecules()->where('status', 'DRAFT')->count() < 1;
})
->action(function () {
$this->ownerRecord->status = 'PUBLISHED';
$this->ownerRecord->is_public = true;
$this->ownerRecord->molecules()->where('status', 'DRAFT')->update(['status' => 'APPROVED']);
$this->ownerRecord->save();
}),
// Tables\Actions\CreateAction::make(),
])
->actions([
Expand Down

0 comments on commit 98d3ba4

Please sign in to comment.