mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Update CreateRecord.php
This commit is contained in:
@@ -44,6 +44,8 @@ class CreateRecord extends Page
|
||||
|
||||
protected static bool $canCreateAnother = true;
|
||||
|
||||
public bool $isCreating = false;
|
||||
|
||||
public function getBreadcrumb(): string
|
||||
{
|
||||
return static::$breadcrumb ?? __('filament-panels::resources/pages/create-record.breadcrumb');
|
||||
@@ -74,6 +76,10 @@ class CreateRecord extends Page
|
||||
|
||||
public function create(bool $another = false): void
|
||||
{
|
||||
if ($this->isCreating) return;
|
||||
|
||||
$this->isCreating = true;
|
||||
|
||||
$this->authorizeAccess();
|
||||
|
||||
try {
|
||||
@@ -99,10 +105,14 @@ class CreateRecord extends Page
|
||||
$this->rollBackDatabaseTransaction() :
|
||||
$this->commitDatabaseTransaction();
|
||||
|
||||
$this->isCreating = false;
|
||||
|
||||
return;
|
||||
} catch (Throwable $exception) {
|
||||
$this->rollBackDatabaseTransaction();
|
||||
|
||||
$this->isCreating = false;
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
@@ -119,6 +129,8 @@ class CreateRecord extends Page
|
||||
|
||||
$this->fillForm();
|
||||
|
||||
$this->isCreating = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user