Revert "rector: arrrrr"

This reverts commit 16c0cd10d8.
This commit is contained in:
Andras Bacsai
2025-01-07 15:31:43 +01:00
parent da07b4fdcf
commit 1fe4dd722b
349 changed files with 3689 additions and 4184 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Models;
use Exception;
use Illuminate\Database\Eloquent\Casts\Attribute;
class GithubApp extends BaseModel
@@ -11,6 +10,11 @@ class GithubApp extends BaseModel
protected $appends = ['type'];
protected $casts = [
'is_public' => 'boolean',
'type' => 'string',
];
protected $hidden = [
'client_secret',
'webhook_secret',
@@ -18,12 +22,12 @@ class GithubApp extends BaseModel
protected static function booted(): void
{
static::deleting(function (GithubApp $githubApp) {
$applications_count = Application::query()->where('source_id', $githubApp->id)->count();
static::deleting(function (GithubApp $github_app) {
$applications_count = Application::where('source_id', $github_app->id)->count();
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.');
throw new \Exception('You cannot delete this GitHub App because it is in use by '.$applications_count.' application(s). Delete them first.');
}
$githubApp->privateKey()->delete();
$github_app->privateKey()->delete();
});
}
@@ -67,12 +71,4 @@ class GithubApp extends BaseModel
},
);
}
protected function casts(): array
{
return [
'is_public' => 'boolean',
'type' => 'string',
];
}
}