PHP code example of novius / laravel-nova-publishable

1. Go to this page and download the library: Download novius/laravel-nova-publishable 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/ */

    

novius / laravel-nova-publishable example snippets


use Laravel\Nova\Resource;
use Novius\LaravelNovaPublishable\Nova\Traits\Publishable;

class Post extends Resource
{
    use Publishable;

class Post extends Resource
{
    public function fields(NovaRequest $request): array
    {
        return [
            PublicationBadge::make(), // Only display on not forms
            PublicationStatusField::make()->onlyOnForms(),
            PublishedFirstAt::make()->hideFromIndex(),
            PublishedAt::make()->onlyOnForms(),
            ExpiredAt::make()->onlyOnForms(),
        ];
    }

    public function filters(NovaRequest $request): array
    {
        return [
            new PublicationStatus(),
        ];
    }
  
    public function actions(Request $request): array
    {
        return [
            UpdatePublicationStatus::make(),
        ];
    }
bash
php artisan vendor:publish --provider="Novius\LaravelNovaPublishable\LaravelNovaPublishableServiceProvider" --tag="lang"