Download the PHP package joshua060198/nova-simple-status-with-enum without Composer
On this page you can find all versions of the php package joshua060198/nova-simple-status-with-enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshua060198/nova-simple-status-with-enum
More information about joshua060198/nova-simple-status-with-enum
Files in joshua060198/nova-simple-status-with-enum
Package nova-simple-status-with-enum
Short Description Simple status field for Laravel Nova
License MIT
Informations about the package nova-simple-status-with-enum
Simple Status With Enum
Simple status indicator using badge field.
Dependency
This package uses:
So, make sure to check out the installation instructions on those packages first.
Installation
Screenshot
Index / Detail
Edit
Usage
-
Create your enum class and apply
MappableStatus
trait. -
MappableStatus
trait provide a static functiongetMappedStatus()
to get status mapping for css classes inBadge
field. You can override this to your need. Important: you need to provide all mapping togetMappedStatus()
function! - Apply it in resource
Constructor
StatusForm
You need to pass the enum class that holds all of constant for your status. The next param is the same as regular nova fields.
Example
StatusView
There are two required params for this. The first one give the actual value for your status field, and the second one pass the enum class that holds all of constant.
Example
IMPORTANT!!
-
This status field will split your constant variable by capital letter and displayed them with spaces. For example:
will be displayed as
-
You need to provide the mapping for your enum constant in
getMappedStatus()
function. For example, this would produce an error later:You have to provide the mapping for
FirstCustomStatus
andAnotherStatus
like this code: - Default mapped status value are :
License
The MIT license.
All versions of nova-simple-status-with-enum with dependencies
bensampo/laravel-enum Version 2.2.0
simplesquid/nova-enum-field Version ^2.2