Add draft functionality for page management: Implemented a new bulk action to move selected pages to draft status in the PagesTable. Added corresponding localization keys for English and Turkish languages to enhance user experience.
This commit is contained in:
@@ -161,6 +161,26 @@ class PagesTable
|
||||
->requiresConfirmation()
|
||||
->deselectRecordsAfterCompletion(),
|
||||
|
||||
BulkAction::make('draft')
|
||||
->label(__('pages.bulk_action_draft'))
|
||||
->icon('heroicon-o-document-text')
|
||||
->color('warning')
|
||||
->action(function ($records) {
|
||||
$count = 0;
|
||||
foreach ($records as $record) {
|
||||
if ($record->draft()) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title(__('pages.bulk_drafted_successfully', ['count' => $count]))
|
||||
->success()
|
||||
->send();
|
||||
})
|
||||
->requiresConfirmation()
|
||||
->deselectRecordsAfterCompletion(),
|
||||
|
||||
DeleteBulkAction::make(),
|
||||
ForceDeleteBulkAction::make(),
|
||||
RestoreBulkAction::make(),
|
||||
|
||||
@@ -244,4 +244,13 @@ class Page extends Model
|
||||
}
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the page to draft status
|
||||
*/
|
||||
public function draft(): bool
|
||||
{
|
||||
$this->status = 'draft';
|
||||
return $this->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user