44 lines
975 B
PHP
44 lines
975 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Actions\Git\GitProviderKey;
|
|
use Database\Factories\UserGitConnectionFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'account_login',
|
|
'account_name',
|
|
'api_token',
|
|
'base_url',
|
|
'provider',
|
|
'provider_user_id',
|
|
'user_id',
|
|
])]
|
|
#[Hidden(['api_token'])]
|
|
class UserGitConnection extends Model
|
|
{
|
|
/** @use HasFactory<UserGitConnectionFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'api_token' => 'encrypted',
|
|
'provider' => GitProviderKey::class,
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|