first commit

This commit is contained in:
2025-03-27 12:25:27 +00:00
commit 25428dbd31
261 changed files with 23580 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use App\Enums\RepositoryType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Application extends Model
{
protected $guarded = [];
protected function casts(): array
{
return [
'repository_type' => RepositoryType::class,
];
}
public function organisation(): BelongsTo
{
return $this->belongsTo(Organisation::class);
}
public function environments(): HasMany
{
return $this->hasMany(Environment::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Environment extends Model
{
protected $guarded = [];
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Organisation extends Model
{
protected $guarded = [];
public function owner(): BelongsTo
{
return $this->belongsTo(User::class, 'owner_id');
}
public function members(): BelongsToMany
{
return $this->belongsToMany(User::class)
->withPivot('role')
->as('membership')
->using(OrganisationUser::class)
->withTimestamps();
}
public function applications(): HasMany
{
return $this->hasMany(Application::class);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use App\Enums\OrganisationRole;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
class OrganisationUser extends MorphPivot
{
protected $guarded = [];
protected function casts(): array
{
return [
'role' => OrganisationRole::class,
];
}
}

16
app/Models/Server.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Server extends Model
{
protected $guarded = [];
public function services(): HasMany
{
return $this->hasMany(Service::class);
}
}

16
app/Models/Service.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Service extends Model
{
protected $guarded = [];
public function server(): BelongsTo
{
return $this->belongsTo(Server::class);
}
}

10
app/Models/Slice.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Slice extends Model
{
//
}

42
app/Models/User.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
protected $fillable = [
'name',
'email',
'password',
];
protected $hidden = [
'password',
'remember_token',
];
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function organisations()
{
return $this->belongsToMany(Organisation::class)
->withPivot('role')
->as('membership')
->using(OrganisationUser::class)
->withTimestamps();
}
}