Added combined unique and default value

This commit is contained in:
dhanabalan
2025-04-08 09:13:14 +05:30
parent 4685b7fbb8
commit f066794bca
14 changed files with 84 additions and 39 deletions

View File

@@ -71,6 +71,9 @@ class PlantResource extends Resource
->relationship('company', 'name')
->required()
->reactive()
->default(function () {
return optional(Plant::latest()->first())->company_id;
})
->disabled(fn (Get $get) => !empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$companyId = $get('company_id');