-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependsOn fields support #4
Comments
Hi, @chrillep Our package is a wrapper on Nova Resources, that's why everything should work |
ok ill try it |
Hey @stepanenko3 ! in app/Nova/Settings/Demo.php <?php
declare(strict_types=1);
namespace App\Nova\Settings;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Stepanenko3\NovaSettings\Types\AbstractType;
class Demo extends AbstractType
{
public function fields(): array
{
return [
Boolean::make('Param 1 Show Text Field', 'param_1')
->default(true),
Text::make('Text That Param 1 Depends on', 'param_1_depends_on')
->hide()
->rules('sometimes')
->dependsOn('param_1', function (Text $field, NovaRequest $request, FormData $formData) {
if ($formData->param_1 === false) {
$field->show()->rules('required');
}
}),
Select::make('Purchase Type', 'type')
->options([
'personal' => 'Personal',
'gift' => 'Gift',
]),
Text::make('Recipient')
->readonly()
->dependsOn(
['type'],
function (Text $field, NovaRequest $request, FormData $formData) {
if ($formData->type === 'gift') {
$field->readonly(false)->rules(['required', 'email']);
}
}
),
];
}
}
|
@chrillep, thanks |
really like your package tho. its just that depends on opens up alot of good ux for showing/hiding fields while editing :) |
@stepanenko3 hey how is it going. Im guessing it is more work than expected (It always is) ;) . Keep up the good work tho! |
@chrillep, hi Because we are not able to update the attributes of already specified dependsOn, you must specify them explicitly
|
does this package have dependsOn fields support?
https://nova.laravel.com/docs/4.0/resources/fields.html#dependent-fields
we are currently using outl1ne/nova-settings
but having issues with dependsOn fields not working. Or thats not fair. they just havent implemented dependson functionality
ref:
The text was updated successfully, but these errors were encountered: