forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditUser.php
More file actions
37 lines (29 loc) · 874 Bytes
/
EditUser.php
File metadata and controls
37 lines (29 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource;
use App\Settings\GeneralSettings;
use Filament\Pages\Actions;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Hash;
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;
protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();
return $settings->content_width;
}
protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
public function beforeSave()
{
if (! array_key_exists('new_password', $this->data) || ! filled($this->data['new_password'])) {
return;
}
$this->record->password = Hash::make($this->data['new_password']);
}
}