bahamagician
bahamagician
FFilament
Created by bahamagician on 4/18/2024 in #❓┊help
Set State of Select Field After Dynamically Populating Via Dependent Field
Hey all, I've been trying to solve this for two days and I'm sure it's something simple that I'm missing but I keep hitting a wall.
Using the code below, I'm populating the "service_call_id" field using an eloquent query based on the "customer_id" field.
However, once the "service_call_id" options have been populated, I'd like to automatically set the state of the "service_call_id" field to the very first result returned from the query. I've tried using default, selectablePlaceholder(false), and manually manipulating the state but I can't seem to find a way to hook into an event that happens after the options are populated. Any help would be GREATLY appreciated:
Forms\Components\Select::make('customer_id')
->relationship('customer', 'email')
->live(onBlur: true)
->searchable()
->required(),
Forms\Components\Select::make('service_call_id')
->options(function (Get $get) {
$serviceCalls = ServiceCall::query()
->whereRelation('workOrder.customer', 'id', $get('customer_id'))
->orderBy('id', 'desc')
->pluck('id', 'id');
return $serviceCalls;
})
->live()
->required(),
Forms\Components\Select::make('customer_id')
->relationship('customer', 'email')
->live(onBlur: true)
->searchable()
->required(),
Forms\Components\Select::make('service_call_id')
->options(function (Get $get) {
$serviceCalls = ServiceCall::query()
->whereRelation('workOrder.customer', 'id', $get('customer_id'))
->orderBy('id', 'desc')
->pluck('id', 'id');
return $serviceCalls;
})
->live()
->required(),
20 replies
FFilament
Created by bahamagician on 1/18/2024 in #❓┊help
How to Add Custom Action Buttons to RelationManager Modal
Normally when I want to add custom actions to a form, I'll use the getHeaderActions method in the pages directory. However, this doesn't exist for relation managers. Is there any way to add a custom action button to my relation manager form/page? In my case I want to attach a "send email" button to the form that opens up in the relation manager modal.
5 replies
FFilament
Created by bahamagician on 9/13/2023 in #❓┊help
Email Verification Problem
I'm having a problem with new users verifying their email. I have my app set up so that I can create new users and I'm using the "MustVerifyEmail" contract to send them a verification email when I've created them. However, I'm having a problem with the link they must click on to verify their email.
Below is the code for the route as per Laravel's docs. However, in my user model I have the canAccessPanel method set to only allow users that have verified their email. So when a user clicks on the link in the email and logs in, they get a 403 | Forbidden error.
I'm assuming that the canAccessPanel method is preventing an unverified email from verifying their email. Can anybody help me figure out how to get around this issue?
use Illuminate\Foundation\Auth\EmailVerificationRequest;

Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();

return redirect('/home');
})->middleware(['auth', 'signed'])->name('verification.verify');
use Illuminate\Foundation\Auth\EmailVerificationRequest;

Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();

return redirect('/home');
})->middleware(['auth', 'signed'])->name('verification.verify');
5 replies
FFilament
Created by bahamagician on 9/1/2023 in #❓┊help
Auth Question
Probably a silly question, but if I've not scaffolded any of the built in laravel auth packages, is there anywhere that a bad actor might still be able to register as a user on my filament site?
2 replies
FFilament
Created by bahamagician on 8/24/2023 in #❓┊help
How to use fillForm() with a repeater?
Hey, I'm trying to set up some tests for my application but how do I use fillForm with a repeater?
livewire(DeliveryResource\Pages\CreateDelivery::class)
->fillForm([
'products' => [
'description' => 'Test',
'qty' => 1
],
])
->call('create')
->assertHasNoFormErrors();
livewire(DeliveryResource\Pages\CreateDelivery::class)
->fillForm([
'products' => [
'description' => 'Test',
'qty' => 1
],
])
->call('create')
->assertHasNoFormErrors();
This doesn't seem to work.
29 replies
FFilament
Created by bahamagician on 8/17/2023 in #❓┊help
Does getDefaultTableSortColumn no longer work in 3.0?
Hey all, it seems like getDefaultTableSortColumn no longer works in 3.0 and you now have to use defaultSort() on the table itself. Just want to confirm if that's true. -=Chris
3 replies
FFilament
Created by bahamagician on 8/16/2023 in #❓┊help
requiredIf() validation isn't working for File Upload component
I'm having a problem where the requiredIf validation doesn't work when I use it on a File Upload component. See code below. Is there a way around this?
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
4 replies
FFilament
Created by bahamagician on 3/17/2023 in #❓┊help
Set Value of Sibling Repeater Field from Form Event?
Can I set the value of a sibling repeater field from a form event listener?
2 replies
FFilament
Created by bahamagician on 3/17/2023 in #❓┊help
Wire Model on Custom Field Class Variable
Maybe a silly question, but when I'm building a custom field, is there any way to use wire:model on a public variable from the custom field class? The input I'm using it on isn't the field I want to bind to the main field value. It's for additional functionality of searching an external API. Right now if I try to use wire:model on a public variable in the custom field class I get an error because it's looking for that variable on the pages.create class.
4 replies
FFilament
Created by bahamagician on 3/16/2023 in #❓┊help
Custom Field Event w/ Data?
Is it possible for a custom field to trigger an event along with some data to use in populating other fields. For example, I have a 'title" field that I'm building that will search the Shopify API for a product title, but once the user selects the title, I'd also like that custom field to send the price and sku for the product up to the "updated" closure or something similar so that I can fill the price and sku fields in the form. Is this possible?
8 replies