WIP Environment UI
This commit is contained in:
@@ -12,7 +12,7 @@ class EnvironmentController extends Controller
|
||||
$id = $request->route('environment');
|
||||
|
||||
return inertia('environments/Show', [
|
||||
'environment' => Environment::findOrFail($id),
|
||||
'environment' => Environment::with('application')->findOrFail($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,26 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
|
||||
class Environment extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function application(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Application::class);
|
||||
}
|
||||
|
||||
public function slices(): HasMany
|
||||
{
|
||||
return $this->hasMany(Slice::class);
|
||||
}
|
||||
|
||||
public function services(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Service::class, Slice::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Drivers\Driver;
|
||||
use App\Enums\ServiceCategory;
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Enums\ServiceType;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -27,6 +28,13 @@ class Service extends Model
|
||||
];
|
||||
}
|
||||
|
||||
public function folderName(): Attribute
|
||||
{
|
||||
return new Attribute(
|
||||
get: fn () => $this->name . '-' . $this->id,
|
||||
);
|
||||
}
|
||||
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
|
||||
Reference in New Issue
Block a user