PHP code example of lupennat / many-inline

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

    

lupennat / many-inline example snippets



use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Http\Requests\NovaRequest;

class User extends Resource
{

    public function fields(Request $request)
    {
        return [
            HasMany::make('User Post', 'posts', Post::class)->inline();
        ];
    }
}


use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Lupennat\ManyInline\HasManyInline;

class Posts extends Resource
{

    use HasManyInline;

    public function fields(Request $request)
    {
        return [
            ID::make(),
            BelongsTo::make(__('User'), 'user', User::class)->hideWhenInline(),
            Text::make(__('Extra Field'), 'extra')->onlyOnInline()
        ];
    }
}