Jacques
Jacques
Explore posts from servers
FFilament
Created by Jacques on 2/21/2024 in #❓┊help
Unique validation
I have a model supporter. I need to when signing up check that a id_number does not exist on supporter and this is fine I get this but I also need to check if the id_number does not exist on members table, because a supporter could be upgraded to member we need to check if the member does not already exist. so what i have is this ->unique(table: Supporter::class, ignoreRecord: true) ->unique(table: Member::class, ignoreRecord: true) the supporter works fine but then the member is also looking for supporter id in members table which it does not have SQLSTATE[42S22]: Column not found: 1054 Unknown column 'supporters.id' in 'where clause' select count(*) as aggregate from members where id_number = 1234 and supporters.id <> 2 how can i get this to work?
4 replies
FFilament
Created by Jacques on 11/19/2023 in #❓┊help
Reuse resource form in another livewire component
Hi I want to know is it possible to reuse a resource form
public function form(Form $form): Form
{
return OrganisationResource::form($form)
->statePath('data')
->getClone()
->model(Organisation::class);
}
public function form(Form $form): Form
{
return OrganisationResource::form($form)
->statePath('data')
->getClone()
->model(Organisation::class);
}
I have this form on livewire component and all is showing fine but when i save the selects is not saving here is dd of data
array:10 [// app/Livewire/Organisation/Register.php:35
"logo" => "LUfEL9i1C2tIr9wIAmkMESQFqoTxgX-metabG9nby5wbmc=-.png"
"name" => "York Stanley Inc"
"district_id" => null
"contact_person" => "Graham Cote Traders"
"contact_number" => "Guzman Rosario Co"
"email" => "[email protected]"
"website" => "https://www.gigazoqug.mobi"
"councilors" => null
"votes" => null
"status" => "pending"
]
array:10 [// app/Livewire/Organisation/Register.php:35
"logo" => "LUfEL9i1C2tIr9wIAmkMESQFqoTxgX-metabG9nby5wbmc=-.png"
"name" => "York Stanley Inc"
"district_id" => null
"contact_person" => "Graham Cote Traders"
"contact_number" => "Guzman Rosario Co"
"email" => "[email protected]"
"website" => "https://www.gigazoqug.mobi"
"councilors" => null
"votes" => null
"status" => "pending"
]
All selects are null for some reason Also I have dependant select based on another select but this is also not working here but does work on original form Any ideas? Is this possible?
17 replies
FFilament
Created by Jacques on 10/20/2023 in #❓┊help
Upload Image on form to a Livewire component
I have a form that has fileupload and is uploading images. On the Filament Resource it all works fine but I also have a form on a custom livewire component on a custom page. All works fine except the file. It is saving the object instead of the path to the database. How can i extract the path here is the dump od $this->data
array:12 [▼ // app/Livewire/OrganisationProfile.php:118
"id" => 2
"name" => "NCCM"
"logo" => array:1 [▼
"2948ff41-e4ae-4094-82b0-f989ed85a318" => Livewire\Features\SupportFileUploads\TemporaryUploadedFile {#1135 ▼
-test: false
-originalName: "V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
-mimeType: "application/octet-stream"
-error: 0
#hashName: null
#disk: "local"
#storage: Illuminate\Filesystem\FilesystemAdapter {#1119 ▶}
#path: "livewire-tmp/V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
path: "/Users/jacques/repos/nccm/storage/app/livewire-tmp"
filename: "V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
basename: "php0jI5V7"
pathname: "/private/var/tmp/php0jI5V7"
extension: ""
realPath: "/Users/jacques/repos/nccm/storage/app/livewire-tmp/V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
aTime: 2023-10-21 01:13:02
mTime: 2023-10-21 01:13:02
cTime: 2023-10-21 01:13:02
inode: 18827423
size: 91313
writable: false
readable: false
executable: false
file: false
dir: false
link: false
}
]
"district" => "Springbok"
"contact_person" => "Ms. Pamela Witting"
"contact_number" => "(270) 772-6158"
"email" => "[email protected]"
"website" => "yundt.info/occaecati-magni-est-itaque-nobis-itaque-saepe-illum"
"councilors" => "0"
"votes" => "1000-1999"
"created_at" => "2023-10-19T17:51:00.000000Z"
"updated_at" => "2023-10-21T00:43:50.000000Z"
]
array:12 [▼ // app/Livewire/OrganisationProfile.php:118
"id" => 2
"name" => "NCCM"
"logo" => array:1 [▼
"2948ff41-e4ae-4094-82b0-f989ed85a318" => Livewire\Features\SupportFileUploads\TemporaryUploadedFile {#1135 ▼
-test: false
-originalName: "V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
-mimeType: "application/octet-stream"
-error: 0
#hashName: null
#disk: "local"
#storage: Illuminate\Filesystem\FilesystemAdapter {#1119 ▶}
#path: "livewire-tmp/V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
path: "/Users/jacques/repos/nccm/storage/app/livewire-tmp"
filename: "V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
basename: "php0jI5V7"
pathname: "/private/var/tmp/php0jI5V7"
extension: ""
realPath: "/Users/jacques/repos/nccm/storage/app/livewire-tmp/V5bm8BgjsJ2yDJMcL41q71GGZ1GEOM-metabmNtTG9nby5wbmc=-.png"
aTime: 2023-10-21 01:13:02
mTime: 2023-10-21 01:13:02
cTime: 2023-10-21 01:13:02
inode: 18827423
size: 91313
writable: false
readable: false
executable: false
file: false
dir: false
link: false
}
]
"district" => "Springbok"
"contact_person" => "Ms. Pamela Witting"
"contact_number" => "(270) 772-6158"
"email" => "[email protected]"
"website" => "yundt.info/occaecati-magni-est-itaque-nobis-itaque-saepe-illum"
"councilors" => "0"
"votes" => "1000-1999"
"created_at" => "2023-10-19T17:51:00.000000Z"
"updated_at" => "2023-10-21T00:43:50.000000Z"
]
at moment its storing the object in database.
9 replies
FFilament
Created by Jacques on 8/3/2023 in #❓┊help
Notify User of unsaved data
Is there easy way to Notify a user of unsaved data? I have datatable with SelectColumn that save on change but just worried that when user is editing on form page that he will think same behaviour is there.
10 replies
FFilament
Created by Jacques on 8/1/2023 in #❓┊help
Notifications Table not found
Just upgraded from v2 to v3 and all is good except for this message i am getting. SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ncm.notifications' doesn't exist https://flareapp.io/share/o7AeD3x7
5 replies