Replies: 6 comments
-
If there is no way, just tell me so I can close this. Thanks |
Beta Was this translation helpful? Give feedback.
-
I had the same problem and solved it like this:
In this case I only needed the 'disabled' attribute, but I think you can understand the logic. |
Beta Was this translation helpful? Give feedback.
-
Did you ever come right here @poseso ? I am also coming over from Laravel Collective and am struggling with this. I tried using @danichurras solution, but am not coming right. |
Beta Was this translation helpful? Give feedback.
-
Using @danichurras as a base, this was the solution to my issue: Controller:
Blade:
of if you need it to work on an 'edit' page:
|
Beta Was this translation helpful? Give feedback.
-
Hello @osirion, I created a component for our issue:
and I use it like this:
|
Beta Was this translation helpful? Give feedback.
-
Would love to have that option, it's very tedious to set disabled attributes on options as far as I can tell |
Beta Was this translation helpful? Give feedback.
-
I'm having problems trying to add custom attributes, my select looks like this:
{{ html()->select('location_id', $business_locations, $default_location)
->class('form-select form-select-solid form-control rounded-start-0 border-start')
->attribute('data-control', 'select2')
->required() }}
which renders:
I have an array of custom data attributes in a variable $location_attributes that I need to put on each like this:
array:2 [▼ // resources/views/backend/pos/purchase_order/create.blade.php
1 => array:6 [▼
"data-receipt_printer_type" => "browser"
"data-default_price_group" => null
"data-default_payment_accounts" => "{"cash":{"is_enabled":1,"account":null},"card":{"is_enabled":1,"account":null},"cheque":{"is_enabled":1,"account":null},"bank_transfer":{"is_enabled":1,"account ▶"
"data-default_sale_invoice_scheme_id" => null
"data-default_invoice_scheme_id" => 1
"data-default_invoice_layout_id" => 1
]
2 => array:6 [▼
"data-receipt_printer_type" => "browser"
"data-default_price_group" => null
"data-default_payment_accounts" => "{"cash":{"is_enabled":1,"account":null},"card":{"is_enabled":1,"account":null},"cheque":{"is_enabled":1,"account":null},"bank_transfer":{"is_enabled":1,"account ▶"
"data-default_sale_invoice_scheme_id" => null
"data-default_invoice_scheme_id" => 2
"data-default_invoice_layout_id" => 2
]
]
is there any additional parameters that I could use to accomplish this?
on Laravel Collective there was 5th parameter that could let set an array of options attributes like this:
Form::select("name", $options, null, [], $option_attributes);
But I haven't found a way to do it with Spatie,
Any help would be greatly appreciated!
Thanks in advanced!
Beta Was this translation helpful? Give feedback.
All reactions