diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.php index c4cd3568d..758bf35c5 100644 --- a/app/Models/GithubApp.php +++ b/app/Models/GithubApp.php @@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute; class GithubApp extends BaseModel { + protected $guarded = []; protected $appends = ['type']; protected $casts = [ @@ -17,6 +18,7 @@ class GithubApp extends BaseModel 'webhook_secret', ]; + static public function public() { return GithubApp::whereTeamId(currentTeam()->id)->whereisPublic(true)->whereNotNull('app_id')->get(); @@ -34,6 +36,7 @@ class GithubApp extends BaseModel if ($applications_count > 0) { throw new \Exception('You cannot delete this GitHub App because it is in use by ' . $applications_count . ' application(s). Delete them first.'); } + $github_app->privateKey()->delete(); }); }