Add project repository connection settings
This commit is contained in:
@@ -53,6 +53,13 @@ class Project extends Model
|
||||
->orderBy('position');
|
||||
}
|
||||
|
||||
public function repositoryConnections(): HasMany
|
||||
{
|
||||
return $this->hasMany(RepositoryConnection::class)
|
||||
->orderBy('provider')
|
||||
->orderBy('repository_full_name');
|
||||
}
|
||||
|
||||
public function tickets(): HasMany
|
||||
{
|
||||
return $this->hasMany(Ticket::class)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Actions\Git\GitProviderKey;
|
||||
use Database\Factories\RepositoryConnectionFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable([
|
||||
'base_url',
|
||||
'owner_name',
|
||||
'project_id',
|
||||
'provider',
|
||||
'provider_repository_id',
|
||||
'repository_full_name',
|
||||
'repository_name',
|
||||
'repository_url',
|
||||
])]
|
||||
class RepositoryConnection extends Model
|
||||
{
|
||||
/** @use HasFactory<RepositoryConnectionFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'provider' => GitProviderKey::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user