Topherllobrera
Using hint that the record is edited.
this is what I did
class ActivityHelper { public static function activityChanges($attribute, $get, $state) { $currentValue = $get($attribute); $personalInfoId = $get('id'); $status = $get('status'); if (!$personalInfoId) { return null; } if ($status === 'Approved') { // Delete activity log for this ID Activity::where('subject_type', 'App\Models\PersonalInformation') ->where('subject_id', $personalInfoId) ->delete(); return null; } $latestActivity = Activity::query() ->where('subject_type', 'App\Models\PersonalInformation') ->where('subject_id', $personalInfoId) // Specific to this personal info record ->where('event', 'updated') ->whereJsonContains("properties->attributes->$attribute", $currentValue) ->whereRaw("JSON_EXTRACT(properties, '$.attributes.$attribute') != JSON_EXTRACT(properties, '$.old.$attribute')") ->latest() ->first(); return $latestActivity ? 'Updated' : null; } }`
21 replies
Issue with FileUpload Component Not Loading in Laravel Filament
this is the official response of @Dan Harrin https://filamentphp.com/content/danharrin-file-previews-not-loading
11 replies
Using hint that the record is edited.
TextInput::make('first_name')
->label('First Name')
->hintcolor('primary')
->hint(fn($record) => $record && $record->wasChanged('first_name') ? 'Updated' : '')
->placeholder('First Name')
->validationMessages(['required' => 'First name is required'])
->required(),
TextInput::make('middle_name')
->label('Middle Name')
->placeholder('Middle Name')
->hintcolor('primary')
->hint(fn($record) => $record && $record->wasChanged('middle_name') ? 'Updated' : ''),
TextInput::make('last_name')
->label('Last Name')
->placeholder('Last Name')
->required()
->hintcolor('primary')
->validationMessages(['required' => 'Last name is required']),
21 replies
Custom Action successRedirectUrl
all in the documentation
https://filamentphp.com/docs/3.x/panels/resources/editing-records
12 replies
Custom Action successRedirectUrl
here is the saved when successfull
use Filament\Notifications\Notification;
protected function getSavedNotification(): ?Notification
{
return Notification::make()
->success()
->title('User updated')
->body('The user has been saved successfully.');
}
12 replies
Custom Action successRedirectUrl
I think you can use Lifecycle hook
https://filamentphp.com/docs/3.x/panels/resources/creating-records#lifecycle-hooks and do the thing you want to do
12 replies