MazeEzam
MazeEzam
FFilament
Created by MazeEzam on 2/15/2024 in #❓┊help
Table TextInput Conditionally Disabled
Awesome, thank you
4 replies
FFilament
Created by slow on 2/13/2024 in #❓┊help
File Upload, PDF FILE ONLY. HOW?
5 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
This is the code I went with.
->afterStateUpdated(function (Livewire $livewire,?string $state, ?string $old) {

if ($old == null){
$old = '0.00';
return $old;
}
Notification::make()
->title('Price Increase Adjusted From ' . $old . '%' . ' to' . ' ' . $state . '%')
->success()
->send();

$livewire->save();
})
->afterStateUpdated(function (Livewire $livewire,?string $state, ?string $old) {

if ($old == null){
$old = '0.00';
return $old;
}
Notification::make()
->title('Price Increase Adjusted From ' . $old . '%' . ' to' . ' ' . $state . '%')
->success()
->send();

$livewire->save();
})
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
Thanks mate, this is now working as I need.
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
Ok thanks, I have misunderstood this completely then. Using your suggestion above
$livewire->save()
$livewire->save()
I tried calling this in the
afterStateUpdated()
afterStateUpdated()
but threw and error "undefined variable $livewire" guessing I need to import a class for livewire?
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
I did, specifically "Reactive fields on blur" My understanding is that adding
->live()
->live()
to a form component would update the DB when the value is changed and the user navigates away from the field? I have to missing something very obvious here......
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
If I remove
->live()
->live()
afterStateUpdated still fires, so I'm not sure of the use case here? The Documentation says
->live()
->live()
should trigger the form to re render, is this not the case?
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
Ok, so what is the point of the
->live()
->live()
function if it doesn't actually do anything? I would have thought this would take care of the Livewire Create and Save etc.
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
Yes it is, just not updating the DB.
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
I removed
->numeric
->numeric
and also
->inputMode()
->inputMode()
but it still doesn't persist to the database on blur focus. The
afterStateUpdated()
afterStateUpdated()
still works as it should though.
18 replies
FFilament
Created by MazeEzam on 2/12/2024 in #❓┊help
Form ->live() Not Working
Thank you but I am using the full filament package, do I still need to add a form to a component?
18 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
I was hoping there may have been lifecycle hooks so I call the statusUpdate method once the rows had been exported
13 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
public static function statusUpdate($custid,$date){
$rows = Adjustment::where('bundle_cust_id', $custid)
->where('review_date' , $date)
->where('status', 'draft')
->get();

foreach ($rows as $row){
Adjustment::where('id', $row->id)
->update(['status' => 'Exported']);
}
// dd($rows);

}
public static function statusUpdate($custid,$date){
$rows = Adjustment::where('bundle_cust_id', $custid)
->where('review_date' , $date)
->where('status', 'draft')
->get();

foreach ($rows as $row){
Adjustment::where('id', $row->id)
->update(['status' => 'Exported']);
}
// dd($rows);

}
13 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
Code from Adjustment Model
13 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
ExportAction::make('Export')
->exporter(AdjustmentExporter::class)
->formats([
ExportFormat::Xlsx,
ExportFormat::Csv,
]),
// Feature for later Status update from draft to exported

->action(function(){

$custid = $this->getOwnerRecord()->bundle_uuid;
$date = $this->getOwnerRecord()->next_review_date;

Adjustment::statusUpdate($custid,$date);
})
ExportAction::make('Export')
->exporter(AdjustmentExporter::class)
->formats([
ExportFormat::Xlsx,
ExportFormat::Csv,
]),
// Feature for later Status update from draft to exported

->action(function(){

$custid = $this->getOwnerRecord()->bundle_uuid;
$date = $this->getOwnerRecord()->next_review_date;

Adjustment::statusUpdate($custid,$date);
})
13 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
I did try this but this overrode the export action.
13 replies
FFilament
Created by MazeEzam on 2/1/2024 in #❓┊help
Export Action - Lifecycle Hooks
Thanks but I believe this is to format the output of the export column value? I want to update the rows inside the Database, on a successful export, specifically a column called Status. I want to know if that rows has already been exported.
13 replies
FFilament
Created by MazeEzam on 1/23/2024 in #❓┊help
Text Input Column Notification
All good, thank you for all your help, much appreciated. 👍
25 replies
FFilament
Created by MazeEzam on 1/23/2024 in #❓┊help
Text Input Column Notification
->updateStateUsing(function($state, $record) {

// Column Name
$columnName = 'new_price';

$record->setAttribute($columnName, $state);
$record->save();

// Your notification code
Notification::make()
->title(' Prices Updated')
->success()
->send();

return $state;
})
->updateStateUsing(function($state, $record) {

// Column Name
$columnName = 'new_price';

$record->setAttribute($columnName, $state);
$record->save();

// Your notification code
Notification::make()
->title(' Prices Updated')
->success()
->send();

return $state;
})
25 replies
FFilament
Created by MazeEzam on 1/23/2024 in #❓┊help
Text Input Column Notification
So I think I have fixed this but using a different approach. It now updates the record in the DB and sends me the notification, only fires if the price has been changed. Is there something else I should be thinking about here though?? Thanks
25 replies