Ric Le Poidevin
Validate and save before opening modal
I have an edit page with a header action that opens a modal.
I need to save (and validate) the current record before opening modal as it depends on that data being saved as it’s a publish action. The form I need to save is a wizard if that makes any difference.
My header action:
2 replies
How to hide null relationships on table
I have a
Table
showing Applications
for Vacancies
(Vacancies
HasMany
Applications
and Applications
BelongsTo
a Vacancy
). When Vacancies
are deleted, any Applications
have their relation set to null
- this is so the person posting a Vacancy
can’t delete an Application
by another user.
I want to try two things:
First idea, how do I filter Applications
will a null
Vacancy
relation? Here’s my current code for show all Applications
and their Vacancy
Second idea - how can I display ‘Deleted vacancy’ if the relationship is null
2 replies
How to get current record on Table action using a custom form field
Hi,
I have a Resource with a Table action using a custom field. I need pass data to the view for this action - all works well for user details but how do I pass the current record’s ID? I’ve tried lots of approaches but it never passes the data
I know I can get the record in my BraintreePayment Blade using
recordId: '{{ $getRecord()->id }}'
but this doesn’t work for me as I want to pass in an object of data to make the component describing the type of payment being made more reusable for different situations.3 replies
Liveware inputs not updating state
I’ve a custom form component that is not updating the Livewire state.
On load the data is correctly initialised and the fields populated. If I use the Alpine JS tools and update a value (green highlight) the input updates. If I update the input (yellow highlight) the state doesn’t update.
4 replies
Multi-tenancy and createOptionForm on Select, Field 'company_id' doesn't have a default value
I have a resource that takes Contacts as a Select options. I want to add a Create form to the Select to create a new Contact but when saving get the following error:
SQLSTATE[HY000]: General error: 1364 Field 'company_id' doesn't have a default value
The ContactResource
form works when used standalone from the menu, but does not when used as the createOptionForm
14 replies
Best way to manage single record resource?
I have a couple of places where I want single record resources (user settings, company details etc.). What’s the best way to build these?
I want to add an item to the menu which goes to either the edit or view page (there is no index page) for the user’s instance of that resource.
Each user has a single record, some are shared by tenants.
When would the record be created? When saving for the first time? Or can it be created when the user is so it’s ready? I don’t have a prefence either way right now.
4 replies
Have expiry date depend on publish date value
I’ve two date pickers, a publish date and an expiry date. How can I link the two so the expiry date has to be within 28 days of the publish date?
And if a publish day is set, then an earlier date selected, how do I ensure the expiry date is updated to be with the 28 day period?
Here’s what I have but I get this error
Call to a member function addDays() on string
. If a date is already set there is no error but nothing updates live when values are changed.
1 replies
Prohibits validation rule
I have a form with two fields - only one should be filled, not both. This would use Laravel’s
prohibits
(https://laravel.com/docs/10.x/validation#rule-prohibits) normally but that is not supported.
I found an old post on here saying to do this:
->prohibited(fn (Closure $get): bool => filled($get('field1')))
But when I try this I get the following error:
App\Filament\Pages\Tenancy\RegisterCompany::App\Filament\Pages\Tenancy\{closure}(): Argument #1 ($get) must be of type Closure, Filament\Forms\Get given, called in /app/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Here’s my form - either the select should be selected or the input filled, not both:
2 replies
Take payments from Actions / Plugins (Braintree)
Hi, I’ve just moved over from Nova and love Filament so far but am stuck. Using V3.
I have a requirement to take a payment using Braintree/PayPal (that’s all that is supported where I live ☹️). After payment is taken a database columns needs to be updated. I thought using a Modal Action would be a good way top handle this but I don’t know where to begin loading the Braintree JS library into the modal, then processing and saving the response to upload the database.
Any help pointing me in the right direction would be appreciated.
3 replies