sezohussien
sezohussien
FFilament
Created by sezohussien on 10/23/2024 in #❓┊help
Getting 403 Forbidden when uploading S3 image
What should I do in the bucket ? I am only getting this error in Production
7 replies
FFilament
Created by sezohussien on 10/23/2024 in #❓┊help
Getting 403 Forbidden when uploading S3 image
No description
7 replies
FFilament
Created by neerajk on 9/3/2024 in #❓┊help
Textarea not showing content and having JS errors
+1
7 replies
FFilament
Created by sezohussien on 8/18/2024 in #❓┊help
Action form wizard select options problem
4 replies
FFilament
Created by sezohussien on 8/18/2024 in #❓┊help
Action form wizard select options problem
4 replies
FFilament
Created by sezohussien on 8/14/2024 in #❓┊help
SpatieFileUpload data not getting with getState()
4 replies
FFilament
Created by sezohussien on 8/14/2024 in #❓┊help
SpatieFileUpload data not getting with getState()
Although when dd($this->form);
Filament\Forms\Form {#2906 ▼ // app/Livewire/CareerApplyJob.php:89
#evaluationIdentifier: "container"
#view: "filament-forms::component-container"
#defaultView: null
#viewData: []
#viewIdentifier: "container"
#livewire:
App\Livewire
\
CareerApplyJob {#2151 ▼
#__id: "EVgt8hed72dU1eQw3sBp"
#__name: "career-apply-job"
#listeners: []
#attributes:
Livewire\Features\SupportAttributes
\
AttributeCollection {#2746 ▶}
#model: "App\Models\JobCandidates"
+data: array:15 [▼
"attachment" => null
"FirstName" => "Astra"
"LastName" => "Edwards"
"Email" => "[email protected]"
"Country" => "Eveniet in id qui "
"City" => "Nisi enim doloremque"
"Street" => "Autem sint labore la"
"ZipCode" => "43744"
"State" => "Labore non ea ut qua"
"CurrentEmployer" => "Omnis nulla consequa"
"CurrentJobTitle" => "Ab quos ut voluptate"
"cover_letter" => "Sit dolorem accusam"
"experience" => "9year"
"attachments" => array:1 [▼
"b8efc3dd-0ecc-4467-986f-92cc59c0799a" =>
Livewire\Features\SupportFileUploads
\
TemporaryUploadedFile {#2154 ▶}
]
"personal_photo" => array:1 [▼
"c937fee8-4e25-4f3b-a444-bbf89f28cede" =>
Livewire\Features\SupportFileUploads
\
TemporaryUploadedFile {#2236 ▼
-test: false
-originalName: "sDIog2UO7o5u5Yszga7qTKjvwAoWxX-metad2FsbHBhcGVyZmxhcmUuY29tX3dhbGxwYXBlci5qcGc=-.jpg"
-mimeType: "application/octet-stream"
-error: 0
#hashName: null
#disk: "s3"
#storage:
Illuminate\Filesystem
\
AwsS3V3Adapter {#2658 ▼
#driver:
League\Flysystem
\
Filesystem {#2659 ▶}
#adapter:
League\Flysystem\AwsS3V3
\
AwsS3V3Adapter {#2653 ▶}

League\Flysystem
\
PathPrefixer {#2662 ▶}

Aws\S3
\
S3Client {#2158 ▶}
}
...
}
]
]
+captcha: ""
Filament\Forms\Form {#2906 ▼ // app/Livewire/CareerApplyJob.php:89
#evaluationIdentifier: "container"
#view: "filament-forms::component-container"
#defaultView: null
#viewData: []
#viewIdentifier: "container"
#livewire:
App\Livewire
\
CareerApplyJob {#2151 ▼
#__id: "EVgt8hed72dU1eQw3sBp"
#__name: "career-apply-job"
#listeners: []
#attributes:
Livewire\Features\SupportAttributes
\
AttributeCollection {#2746 ▶}
#model: "App\Models\JobCandidates"
+data: array:15 [▼
"attachment" => null
"FirstName" => "Astra"
"LastName" => "Edwards"
"Email" => "[email protected]"
"Country" => "Eveniet in id qui "
"City" => "Nisi enim doloremque"
"Street" => "Autem sint labore la"
"ZipCode" => "43744"
"State" => "Labore non ea ut qua"
"CurrentEmployer" => "Omnis nulla consequa"
"CurrentJobTitle" => "Ab quos ut voluptate"
"cover_letter" => "Sit dolorem accusam"
"experience" => "9year"
"attachments" => array:1 [▼
"b8efc3dd-0ecc-4467-986f-92cc59c0799a" =>
Livewire\Features\SupportFileUploads
\
TemporaryUploadedFile {#2154 ▶}
]
"personal_photo" => array:1 [▼
"c937fee8-4e25-4f3b-a444-bbf89f28cede" =>
Livewire\Features\SupportFileUploads
\
TemporaryUploadedFile {#2236 ▼
-test: false
-originalName: "sDIog2UO7o5u5Yszga7qTKjvwAoWxX-metad2FsbHBhcGVyZmxhcmUuY29tX3dhbGxwYXBlci5qcGc=-.jpg"
-mimeType: "application/octet-stream"
-error: 0
#hashName: null
#disk: "s3"
#storage:
Illuminate\Filesystem
\
AwsS3V3Adapter {#2658 ▼
#driver:
League\Flysystem
\
Filesystem {#2659 ▶}
#adapter:
League\Flysystem\AwsS3V3
\
AwsS3V3Adapter {#2653 ▶}

League\Flysystem
\
PathPrefixer {#2662 ▶}

Aws\S3
\
S3Client {#2158 ▶}
}
...
}
]
]
+captcha: ""
4 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
I need to use dehydrated here
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
No description
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
set in which method ? also I need the adding the default values which is ($form->model->roles->pluck('id')->toArray();)
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
So what should I do ? any recommendation
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
but the data(Roles) is not sending when saving
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Card::make()
->schema([
Forms\Components\Repeater::make('academies')
->label('academies')
->relationship('academies')
->schema([
Forms\Components\TextInput::make('title')
->label('title')
->disabled(),

CheckboxList::make('roles')
->label('roles')
->options(function ($record) {
return $record->roles->pluck('name', 'id')->toArray();
})
])
->dehydrated()
->addable(false)
->columns(1),
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Group::make()
->schema([
Forms\Components\Card::make()
->schema([
Forms\Components\Repeater::make('academies')
->label('academies')
->relationship('academies')
->schema([
Forms\Components\TextInput::make('title')
->label('title')
->disabled(),

CheckboxList::make('roles')
->label('roles')
->options(function ($record) {
return $record->roles->pluck('name', 'id')->toArray();
})
])
->dehydrated()
->addable(false)
->columns(1),
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
in resource
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
how can I fill the data in mounted ?
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
I just need edit form only
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
so, how to auto select ?
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
->default() is not working with CheckboxList
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
ok thanks but afterStateHydrated still have problem on it, I need to set the default checkboxes checked IIF ID of the checkbox in the $roleIds = $form->model->roles->pluck('id')->toArray();
47 replies
FFilament
Created by sezohussien on 7/31/2024 in #❓┊help
Default options of checkbox list
every thins is working now but data is not refreshed after save (its saved in DB):
protected function handleRecordUpdate(Model $record, array $data): Model
{
$record->update($data);

$this->syncRoles($data);

return $record;
}

protected function syncRoles($data): void
{
$roles = Arr::get($data, 'roles', []);

// Synchronize roles with the resource
$this->record->roles()->sync($roles);
}

protected function collectUniqueRoleIds(array $academies): array
{
return Collection::make($academies)
->pluck('roles')
->flatten()
->unique()
->values()
->toArray();
}

protected function mutateFormDataBeforeSave($data): array
{
$academies = Arr::get($data, 'academies', []);
$data['roles'] = $this->collectUniqueRoleIds($academies);
return $data;
}
protected function handleRecordUpdate(Model $record, array $data): Model
{
$record->update($data);

$this->syncRoles($data);

return $record;
}

protected function syncRoles($data): void
{
$roles = Arr::get($data, 'roles', []);

// Synchronize roles with the resource
$this->record->roles()->sync($roles);
}

protected function collectUniqueRoleIds(array $academies): array
{
return Collection::make($academies)
->pluck('roles')
->flatten()
->unique()
->values()
->toArray();
}

protected function mutateFormDataBeforeSave($data): array
{
$academies = Arr::get($data, 'academies', []);
$data['roles'] = $this->collectUniqueRoleIds($academies);
return $data;
}
47 replies