PHP code example of moonshine / changelog

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

    

moonshine / changelog example snippets


class Post extends Model
{
    use HasChangeLog;
}

protected function bottomLayer(): array
{
    return [
        ...parent::bottomLayer(),

        ChangeLog::make('Changelog', $this->getResource())
    ];
}

class PostResource extends ModelResource
{
    // ...
    protected function onLoad(): void
    {
        $this->getFormPage()->pushToLayer(
            Layer::BOTTOM,
            ChangeLog::make('Changelog', $this)
        );
    }
    // ...
}

ChangeLog::make('Changelog', $this)->limit(10)

ChangeLog::make('Changelog', $this, userResource: \App\MoonShine\Resources\MoonShineUserResource::class)->limit(10)
shell
php artisan migrate