PHP code example of novius / laravel-nova-page-manager

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


// EN version : resource/lang/en/validation.php
'unique_page' => 'The field :attribute must be unique in this language.',

// FR version : resource/lang/fr/validation.php
'unique_page' => 'Le champ :attribute doit être unique dans cette langue.',

// ...

'locales' => [
    'en' => 'English',
    'fr' => 'French',
],

// ...

// ...

'templates' => [
    \App\Nova\Templates\StandardTemplate::class,
],



namespace App\Nova\Templates;

use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\Trix;
use Novius\LaravelNovaPageManager\Templates\AbstractPageTemplate;

class StandardTemplate extends AbstractPageTemplate
{
    public function templateName(): string
    {
        return trans('laravel-nova-page-manager::template.standard_template');
    }

    public function templateUniqueKey(): string
    {
        return 'standard';
    }

    public function fields(): array
    {
        return [
            Trix::make('Content', 'content'),
            Date::make('Date', 'date'),
        ];
    }
    
    public function casts() : array
    {
        return [
            'date' => 'date',        
        ];
    }
}

$page = \Novius\LaravelNovaPageManager\Models\Page::where('template', 'standard')->first();

$content = $page->extras['content'];

// Date will be a Carbon instance, thanks to the cast
$date = $page->extras['date'];
shell
php artisan page-manager:publish-front
sh
php artisan vendor:publish --provider="Novius\LaravelNovaPageManager\LaravelNovaPageManagerServiceProvider" --tag="config"