PHP code example of zakariatlilani / nova-nested-tree
1. Go to this page and download the library: Download zakariatlilani/nova-nested-tree 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/ */
zakariatlilani / nova-nested-tree example snippets
use zakariatlilani\NovaNestedTree\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 zakariatlilani\NovaNestedTree\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', '
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.