-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b714026
commit 5009e8b
Showing
4 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Miguilim\FilamentAutoPanel\Filament\Pages; | ||
|
||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class FilamentAutoResourceEdit extends EditRecord | ||
{ | ||
protected function fillForm(): void | ||
{ | ||
if (static::getResource()::getIntrusive()) { | ||
$data = $this->getRecord()->setHidden([])->attributesToArray(); | ||
} else { | ||
$data = $this->getRecord()->attributesToArray(); | ||
} | ||
|
||
$this->fillFormWithDataAndCallHooks($data); | ||
} | ||
|
||
protected function handleRecordUpdate(Model $record, array $data): Model | ||
{ | ||
if (static::getResource()::getIntrusive()) { | ||
$record->forceFill($data)->save(); | ||
} else { | ||
$record->update($data); | ||
} | ||
|
||
return $record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters