PHP code example of smousss / laravel-novalize

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

    

smousss / laravel-novalize example snippets


namespace App\Nova;

use …

class Post extends Resource
{
    public static $model = \App\Models\Post::class;

    public static $title = 'title';

    public static $search = [
        'id', 'title', 'slug', 'content', 'description',
    ];

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            BelongsTo::make('User'),

            Text::make('Title')
                ->rules('ngsToMany::make('Tags'),

            HasMany::make('Pins'),
        ];
    }
}
bash
php artisan vendor:publish --tag=novalize-config