new uuid routes
This commit is contained in:
@@ -318,7 +318,7 @@ class Application extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.application.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'application_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class Application extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
$route = route('project.application.scheduled-tasks', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'application_uuid' => data_get($this, 'uuid'),
|
||||
'task_uuid' => $task_uuid,
|
||||
]);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
#[OA\Schema(
|
||||
description: 'Project model',
|
||||
@@ -24,8 +25,6 @@ class Project extends BaseModel
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
protected $appends = ['default_environment'];
|
||||
|
||||
public static function ownedByCurrentTeam()
|
||||
{
|
||||
return Project::whereTeamId(currentTeam()->id)->orderByRaw('LOWER(name)');
|
||||
@@ -40,6 +39,7 @@ class Project extends BaseModel
|
||||
Environment::create([
|
||||
'name' => 'production',
|
||||
'project_id' => $project->id,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
});
|
||||
static::deleting(function ($project) {
|
||||
@@ -140,18 +140,4 @@ class Project extends BaseModel
|
||||
{
|
||||
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
|
||||
}
|
||||
|
||||
public function getDefaultEnvironmentAttribute()
|
||||
{
|
||||
$default = $this->environments()->where('name', 'production')->first();
|
||||
if ($default) {
|
||||
return $default->name;
|
||||
}
|
||||
$default = $this->environments()->get();
|
||||
if ($default->count() > 0) {
|
||||
return $default->sortBy('created_at')->first()->name;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ class Service extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.service.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'service_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ class Service extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
$route = route('project.service.scheduled-tasks', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'service_uuid' => data_get($this, 'uuid'),
|
||||
'task_uuid' => $task_uuid,
|
||||
]);
|
||||
|
||||
@@ -169,7 +169,7 @@ class StandaloneClickhouse extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneDragonfly extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneKeydb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneMariadb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ class StandaloneMongodb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class StandaloneMysql extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class StandalonePostgresql extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class StandaloneRedis extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user