1. Go to this page and download the library: Download marcobax/nova-status-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marcobax / nova-status-field example snippets
// for example, in app/Nova/Blog.php
use MarcoBax\StatusField\StatusField;
// ...
public function fields(Request $request) {
return [
// Use a single value for tooltips and info...
StatusField::make('Published')
->icons([
'minus-circle' => $this->published == 0,
'clock' => $this->pending == 1 && $this->published == 0,
'check-circle' => $this->pending == 0 && $this->published == 1
])
->color('primary') // optional
->solid(true) // optional
->tooltip($this->status) // optional
->info("Blog status: ".$this->status) // optional
->exceptOnForms()
// ...or change text based on the value
StatusField::make('Published')
->icons([
'minus-circle' => $this->published == 0,
'clock' => $this->pending == 1 && $this->published == 0,
'check-circle' => $this->pending == 0 && $this->published == 1
])
->tooltip([
'minus-circle' => 'Not published',
'clock' => 'Pending publication',
'check-circle' => 'Published'
])
->info([
'minus-circle' => 'This blog is not published yet.',
'clock' => 'This blog is pending publication.',
'check-circle' => 'This blog is published on '.$this->published_at->format('d-m-Y').'.'
])
->color([
'minus-circle' => 'red-500',
'clock' => 'blue-500',
'check-circle' => 'green-500'
])
->exceptOnForms()
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.