<?php
namespace App\Filament\Resources\UserResource\Pages;
use Filament\Pages\Actions;
...
class ManageUsers extends ManageRecords
{
protected static string $resource = UserResource::class;
protected function getActions(): array
{
return [
CreateAction::make()
->mutateFormDataUsing(function (array $data): array {
$data['password'] = Hash::make(Str::random(30));
return $data;
})
->after(function(array $data) {
dd($this->record);
$token = Str::random(35);
DB::table('password_reset_tokens')->insert([
'email' => $this->record->email,
'token' => bcrypt($token),
'created_at' => now(),
]);
event(new Registered($this->record));
$this->record->notify(new ResetPassword($token));
})
];
}
}
<?php
namespace App\Filament\Resources\UserResource\Pages;
use Filament\Pages\Actions;
...
class ManageUsers extends ManageRecords
{
protected static string $resource = UserResource::class;
protected function getActions(): array
{
return [
CreateAction::make()
->mutateFormDataUsing(function (array $data): array {
$data['password'] = Hash::make(Str::random(30));
return $data;
})
->after(function(array $data) {
dd($this->record);
$token = Str::random(35);
DB::table('password_reset_tokens')->insert([
'email' => $this->record->email,
'token' => bcrypt($token),
'created_at' => now(),
]);
event(new Registered($this->record));
$this->record->notify(new ResetPassword($token));
})
];
}
}