PHP code example of carloscgo / nova-belongsto-depend
1. Go to this page and download the library: Download carloscgo/nova-belongsto-depend 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/ */
carloscgo / nova-belongsto-depend example snippets
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Name')->rules('e('Department')
->optionsResolve(function ($company) {
// Reduce the amount of unnecessary data sent
return $company->departments()->get(['id','name']);
})
->dependsOn('Company'),
NovaBelongsToDepend::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(' NovaBelongsToDepend::make('Article')
->optionsResolve(function ($warehouse) {
return $warehouse->articles;
})
->dependsOn('Warehouse')
->rules(' ->rules('
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.