PHP code example of creode / nova-publishable

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

    

creode / nova-publishable example snippets


use PawelMysior\Publishable\Publishable;

class Post extends Model
{
    use Publishable;
}

use Creode\LaravelPublishable\Published;

class Post extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            Published::make('Published', 'published_at'),
        ];
    }
}

use Creode\NovaPublishable\Actions\PublishAction;
use Creode\NovaPublishable\Actions\UnpublishAction;

class Post extends Resource
{
    // ...

    public function actions(Request $request)
    {
        return [
            // ...

            new PublishAction,
            new UnpublishAction,
        ];
    }
}