PHP code example of emilianotisato / nova-belongsto-depends
1. Go to this page and download the library: Download emilianotisato/nova-belongsto-depends 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/ */
emilianotisato / nova-belongsto-depends example snippets
// Add the use statement a the top of your nova resource
use EmilianoTisato\NovaBelongsToDepends\NovaBelongsToDepends;
// ...
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Name')->rules('nt
return $company->departments()->get(['id','name']);
})
->dependsOn('Company'),
NovaBelongsToDepends::make('Location')
->optionsResolve(function ($company) {
// Reduce the amount of unnecessary data sent
return $company->locations()->get(['id','name']);
})
->dependsOn('Company'),
];
}
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Name')->rules(' NovaBelongsToDepends::make('Article')
->optionsResolve(function ($warehouse) {
return $warehouse->articles;
})
->dependsOn('Warehouse')
->rules('->rules('