PHP code example of semihkeskindev / laravel-nova-field-dynamic-select
1. Go to this page and download the library: Download semihkeskindev/laravel-nova-field-dynamic-select 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/ */
semihkeskindev / laravel-nova-field-dynamic-select example snippets
public function fields(Request $request)
{
return [
ID::make()->sortable(),
DynamicSelect::make('Country', 'country')
->options(['US' => 'United States', 'UK' => 'United Kingdom'])
->rules('ependsOn(['country', 'provider'])
->options(function($values) {
if($values['country'] === 'UK' && $values['provider'] === 'PR') {
return ['A' => 'Fast shipping', 'B' => 'Normal shipping', 'C' => 'Free shipping'];
} else {
return ['A' => 'Fast shipping', 'B' => 'Normal shipping'];
}
})
->rules('