coolify/app/Models/GithubApp.php

28 lines
773 B
PHP
Raw Normal View History

2023-03-28 12:09:34 +02:00
<?php
namespace App\Models;
class GithubApp extends BaseModel
{
2023-05-09 14:42:10 +02:00
protected $fillable = ['name', 'uuid', 'organization', 'api_url', 'html_url', 'custom_user', 'custom_port', 'team_id'];
2023-04-19 14:00:31 +02:00
protected $casts = [
'is_public' => 'boolean',
];
2023-03-28 12:09:34 +02:00
public function applications()
{
return $this->morphMany(Application::class, 'source');
}
public function privateKey()
{
return $this->belongsTo(PrivateKey::class);
}
2023-05-08 11:51:03 +02:00
static public function public()
{
return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', true)->get();
}
static public function private()
{
2023-05-09 09:54:43 +02:00
return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', false)->get();
2023-05-08 11:51:03 +02:00
}
2023-03-28 12:09:34 +02:00
}