islandnuge
islandnuge
Explore posts from servers
FFilament
Created by islandnuge on 11/8/2024 in #❓┊help
Is there a way to force a page refresh/reload on the user saving a record?
I have some post-processing to execute after an initial record is created and want to force a page-reload once the record is first created. I don't see anything in the documentation that addresses this - I'd prefer not having to coach the users to shift-R manually. Is there a best-practice for approaching this?
2 replies
FFilament
Created by islandnuge on 11/4/2024 in #❓┊help
Ensuring a new record is saved and created before contents of afterStateUpdated() are executed
I have a file upload that allows for multiple uploads and depends on data in the record assosciated with the upload. I"m unsure how to make sure the resource record is created before any logic is executed inside the stateUpdated function - is there not a way to force this? This only occurs if the user hasn't saved the record before triggering an upload. I'd like to have it cleanly handle this case than force the user to save first.
2 replies
FFilament
Created by islandnuge on 10/28/2024 in #❓┊help
Uploading multiple images and post-processing
Hi heroes, am having trouble getting this upload to save correctly - I have a form that allows for multiple file uploads (images) for a photo gallery. I've figured out how to handle the post-processing step with the afterStateUpdated() method, but when enumerating the files collection I'm having trouble resolving the filenames. heres' my snippet, can anyone provide some insight as to where I'm going wrong? I am new to filament, and want to use the same string for the filesystem filename and the "filename" field in my record. I think I am getting differing values due to teh livewire lifecycle and can't seem to get it straight. Any help is greatly appreciated
->afterStateUpdated(function ($state, $set, $record) {
// This function will be called after files are uploaded
foreach ($state as $file) {
$originalFilename = $file->getClientOriginalName(); // Get the original filename
$savedFilename = $file->hashName(); // get the saved filename with extension
$filename = pathinfo($savedFilename, PATHINFO_BASENAME);

// Create a new Photo record for each uploaded file
Photo::create([
'gallery_id' => $record->id,
'filename' => $filename,
'name' => $originalFilename
]);
}
})->columnSpan("full"),
->afterStateUpdated(function ($state, $set, $record) {
// This function will be called after files are uploaded
foreach ($state as $file) {
$originalFilename = $file->getClientOriginalName(); // Get the original filename
$savedFilename = $file->hashName(); // get the saved filename with extension
$filename = pathinfo($savedFilename, PATHINFO_BASENAME);

// Create a new Photo record for each uploaded file
Photo::create([
'gallery_id' => $record->id,
'filename' => $filename,
'name' => $originalFilename
]);
}
})->columnSpan("full"),
1 replies
FFilament
Created by islandnuge on 10/18/2024 in #❓┊help
Customization beyond themes and css
This may be a dumb question, but if I wanted to modify the filemament to be different like add a header / footer, sidebar, etc. is this possible to deviate from the vanilla layout? I am looking at plugins and those seem to be useful for widgets, just wondering how far is realistically possible to help this fit in with client sites and ui's. I am evaluating a wholesale switch from other CSS's to using filament and am anticipating some of the request as a result from clients. Is there any useful resources you can point out that may touch on this? (so far "customzine" has be to css changes only as far as what I've found) Thanks so much - the main site, blogs and tricks are really awesome and am really starting to enjoy Filmanent - and will be getting familliar with many plugins!
4 replies
FFilament
Created by islandnuge on 1/21/2024 in #❓┊help
Using jetstream auth with filament
I'm new to filament and just kicked off a new project that uses Jetstream as part of its scaffolding. I'm looking to integrate filament and realized it has its own login flow and I'm looking to use just the auth login and allow access to users that have been gratned the appropriate role. (I don't want to maintain to seperate login flows). I'm having trouble getting it working and am wondering if anyone can point me in the right direction for necessary steps I've updated my config/auth.php to reference my user model, and added implements FilamentUser to my user model - I acn login without an issue on the default login but the admin login returns "These credentials do not match our records." Any chance someone can shed some light on other steps I need to follow?
7 replies