PHP code example of kirschbaum-development / nova-inline-relationship

1. Go to this page and download the library: Download kirschbaum-development/nova-inline-relationship 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/ */

    

kirschbaum-development / nova-inline-relationship example snippets


namespace App\Nova;

use Laravel\Nova\Fields\Image;

class BlogPost extends Resource
{
    //...
    public function fields(Request $request)
    {
        return [
            //...

            HasMany::make('Images', 'images', Image::class)->inline(),
        ];
    }
}

HasMany::make('Images')->inline()->sortUsing('order'),

HasOne::make('Profile', 'profile', Profile::class)->inline()->

'third-party' => [
    'App\Nova\ThirdPartyIntegrations',
    'KirschbaumDevelopment\NovaInlineRelationship\Integrations',
]



namespace App\Nova\ThirdPartyIntegrations;

use KirschbaumDevelopment\NovaInlineRelationship\Integrations\ThirdParty;
use KirschbaumDevelopment\NovaInlineRelationship\Integrations\Contracts\ThirdPartyContract;

class SomeThirdPartyField extends ThirdParty implements ThirdPartyContract
{
    /**
     * Fields array from object.
     *
     * @return array
     */
    public function fields(): array
    {
        // The following is just an example and should be updated to meet your needs.
        return $this->field->customFieldArray;
    }
}
shell script
php artisan vendor:publish