mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
Introduce filament
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\User\UserResource\Pages;
|
||||
|
||||
use App\Filament\Resources\User\UserResource;
|
||||
use App\Repositories\UserRepository;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CreateUser extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
public function create(bool $another = false): void
|
||||
{
|
||||
$userRep = new UserRepository();
|
||||
$data = $this->form->getState();
|
||||
try {
|
||||
$this->record = $userRep->store($data);
|
||||
$this->notify(
|
||||
'success ',
|
||||
$this->getCreatedNotificationMessage(),
|
||||
);
|
||||
$this->redirect($this->getRedirectUrl());
|
||||
} catch (\Exception $exception) {
|
||||
$this->notify(
|
||||
'danger',
|
||||
$exception->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user