Notify user assigned or detached using Select

Hi guys, I have model Task and model User.
class Task extends Model
{
public function users(): Relations\BelongsToMany
{
return $this->belongsToMany(User::class)
->withPivot('assigned_at')
->withCasts(['assigned_at' => 'datetime'])
->withTimestamps();
}
}
class Task extends Model
{
public function users(): Relations\BelongsToMany
{
return $this->belongsToMany(User::class)
->withPivot('assigned_at')
->withCasts(['assigned_at' => 'datetime'])
->withTimestamps();
}
}
Then I have this select component inside TaskResource:
Forms\Components\Select::make('users')
->label('Users')
->relationship('users', 'name')
->searchable()
->preload()
->multiple(),
Forms\Components\Select::make('users')
->label('Users')
->relationship('users', 'name')
->searchable()
->preload()
->multiple(),
Is it even possible to notify only assigned or detached users using this Select? I probably know how to do that via relation manager and button Attach and Detach, but I want to do it via this Select.
3 Replies
LeandroFerreira
LeandroFerreira8mo ago
Do you mean, send a notification afterStateUpdated?
Trauma Zombie
Trauma ZombieOP8mo ago
I want to send it after form is submitted. This is probably Laravel problem. For example, when I already have Task, and someone edited it, adds new user via that Select field, I want to send notification to that new user.
toeknee
toeknee8mo ago
does after exist on the attach/detach action?
Want results from more Discord servers?
Add your server