Download the PHP package optimistdigital/nova-drafts without Composer
On this page you can find all versions of the php package optimistdigital/nova-drafts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download optimistdigital/nova-drafts
More information about optimistdigital/nova-drafts
Files in optimistdigital/nova-drafts
Package nova-drafts
Short Description A Laravel Nova field that allows you to make drafts of your current resources.
License MIT
Informations about the package nova-drafts
Nova Drafts
This Laravel Nova field allows you to make drafts of your resources.
Features
- Create Drafts
- Unpublish resources (disable them)
- Artisan Command to create Migration
Screenshots
Installation
Install the package in a Laravel Nova project via Composer:
Usage
Preparing the models and database
This field requires a few database changes - namely, the model requires three new columns Migrations can be created using the following Artisan command:
if table name is not provided, a choice of all available tables is provided.
If your table has pre-existing Unique constraint: It's recommended to add 'published' field to the unique constraint. More information inside the migration file.
Defining the field
Index Filtering (IndexQuery)
Inside your Model add the following snippet:
Inside your Index Query use that function, to filter out published pages that have drafts:
Options
Possible option you can pass to the field using the option name as a function
Option | Type | Default | Description |
---|---|---|---|
draftsEnabled |
boolean | true | boolean whether drafts are enabled or not |
Localization and text customization
The translation file(s) can be published by using the following publish command:
You can add your translations to resources/lang/vendor/nova-drafts/
by creating a new translations file with the locale name (ie et.json
) and copying the JSON from the existing en.json
.
Credits
License
Nova Drafts is open-sourced software licensed under the MIT license