PHP code example of lupennat / nova-expandable-many
1. Go to this page and download the library: Download lupennat/nova-expandable-many 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 / nova-expandable-many example snippets
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Http\Requests\NovaRequest;
class User extends Resource
{
use Lupennat\ExpandableMany\HasExpandableMany;
public function fields(Request $request)
{
return [
HasMany::make('User Post', 'posts', Post::class)->expandable();
];
}
}
HasMany::make('User Post', 'posts', Post::class)->expandable()
->withMeta([
// 'expandableStoreStatus' => 'full', // will store status also for relationships
'expandableStoreStatus' => 'accordion', // will store status only for accordion
'expandableStoreStatus' => '', // will not store any status
])
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Lenses\Lens;
class UserLens extends Lens
{
use Lupennat\ExpandableMany\HasExpandableManyLens;
public function fields(Request $request)
{
return [
HasMany::make('User Post', 'posts', Post::class)->expandable();
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.