mirror of
https://github.com/tiennm99/coolify.git
synced 2026-06-23 21:38:49 +00:00
1da1f32f0e
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.
22 lines
547 B
PHP
22 lines
547 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\New;
|
|
|
|
use App\Models\Project;
|
|
use Livewire\Component;
|
|
use Visus\Cuid2\Cuid2;
|
|
|
|
class EmptyProject extends Component
|
|
{
|
|
public function createEmptyProject()
|
|
{
|
|
$project = Project::forceCreate([
|
|
'name' => generate_random_name(),
|
|
'team_id' => currentTeam()->id,
|
|
'uuid' => (string) new Cuid2,
|
|
]);
|
|
|
|
return redirectRoute($this, 'project.show', ['project_uuid' => $project->uuid, 'environment_uuid' => $project->environments->first()->uuid]);
|
|
}
|
|
}
|