mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 08:17:02 +00:00
refactor: use forceCreate() for internal model creation
Replace create() with forceCreate() across internal model creation operations to bypass mass assignment protection. This is appropriate for internal code that constructs complete model state without user input. Add InternalModelCreationMassAssignmentTest to ensure internal model creation behavior is properly tested. Optimize imports by using shortened Livewire attribute references and removing unused imports.
This commit is contained in:
1 parent
71cde5a063
commit
1da1f32f0e
41 files changed
+265
-145
No files matched your search
@@ -5,7 +5,6 @@ namespace App\Livewire\Destination\New;
|
||||
use App\Models\Server;
|
||||
use App\Models\StandaloneDocker;
|
||||
use App\Models\SwarmDocker;
|
||||
use App\Support\ValidationPatterns;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Attributes\Validate;
|
||||
@@ -78,7 +77,7 @@ class Docker extends Component
|
||||
if ($found) {
|
||||
throw new \Exception('Network already added to this server.');
|
||||
} else {
|
||||
$docker = SwarmDocker::create([
|
||||
$docker = SwarmDocker::forceCreate([
|
||||
'name' => $this->name,
|
||||
'network' => $this->network,
|
||||
'server_id' => $this->selectedServer->id,
|
||||
@@ -89,7 +88,7 @@ class Docker extends Component
|
||||
if ($found) {
|
||||
throw new \Exception('Network already added to this server.');
|
||||
} else {
|
||||
$docker = StandaloneDocker::create([
|
||||
$docker = StandaloneDocker::forceCreate([
|
||||
'name' => $this->name,
|
||||
'network' => $this->network,
|
||||
'server_id' => $this->selectedServer->id,
|
||||
|
||||
Reference in new issue
Block a user