PHP code example of phoenix-lib / nova-nested-tree-attach-many
1. Go to this page and download the library: Download phoenix-lib/nova-nested-tree-attach-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/ */
phoenix-lib / nova-nested-tree-attach-many example snippets
use PhoenixLib\NestedTreeAttachMany\NestedTreeAttachManyField;
public function fields(Request $request)
{
return [
NestedTreeAttachManyField::make('Offer Categories',"categories","App\Nova\Category"),
];
}
class Category extends Model
{
use NodeTrait;
}
use Whitecube\NovaFlexibleContent\Flexible;
use PhoenixLib\NovaNestedTreeAttachMany\NestedTreeAttachManyField;
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
// ...
Flexible::make('Content')
->addLayout('Simple content section', 'tree_section', [
NestedTreeAttachManyField::make('Tree',"tree","App\Nova\Category")
->useAsField(),
])
];
}
->rules('min:5', 'max:10', 'size:10', '