Skip to content

Commit 92c1c16

Browse files
committed
Code cleanup for facades
1 parent 6ffe573 commit 92c1c16

File tree

9 files changed

+14
-211
lines changed

9 files changed

+14
-211
lines changed

app/Facades/Activity.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,8 @@
33
namespace Pterodactyl\Facades;
44

55
use Illuminate\Support\Facades\Facade;
6-
use Illuminate\Database\Eloquent\Model;
76
use Pterodactyl\Services\Activity\ActivityLogService;
87

9-
/**
10-
* @method static ActivityLogService anonymous()
11-
* @method static ActivityLogService event(string $action)
12-
* @method static ActivityLogService description(?string $description)
13-
* @method static ActivityLogService subject(Model|Model[] $subject)
14-
* @method static ActivityLogService actor(Model $actor)
15-
* @method static ActivityLogService withRequestMetadata()
16-
* @method static ActivityLogService property(string|array $key, mixed $value = null)
17-
* @method static \Pterodactyl\Models\ActivityLog log(string $description = null)
18-
* @method static ActivityLogService clone()
19-
* @method static void reset()
20-
* @method static mixed transaction(\Closure $callback)
21-
*/
228
class Activity extends Facade
239
{
2410
protected static function getFacadeAccessor()

app/Facades/LogBatch.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
use Illuminate\Support\Facades\Facade;
66
use Pterodactyl\Services\Activity\AcitvityLogBatchService;
77

8-
/**
9-
* @method static ?string uuid()
10-
* @method static void start()
11-
* @method static void end()
12-
* @method static mixed transaction(\Closure $callback)
13-
*/
148
class LogBatch extends Facade
159
{
1610
protected static function getFacadeAccessor()

app/Facades/LogTarget.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
use Illuminate\Support\Facades\Facade;
66
use Pterodactyl\Services\Activity\ActivityLogTargetableService;
77

8-
/**
9-
* @method static void setActor(\Illuminate\Database\Eloquent\Model $actor)
10-
* @method static void setSubject(\Illuminate\Database\Eloquent\Model $subject)
11-
* @method static \Illuminate\Database\Eloquent\Model|null actor()
12-
* @method static \Illuminate\Database\Eloquent\Model|null subject()
13-
* @method static void reset()
14-
*/
158
class LogTarget extends Facade
169
{
1710
protected static function getFacadeAccessor()

app/Http/Middleware/AccountActivitySubject.php renamed to app/Http/Middleware/Activity/AccountSubject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace Pterodactyl\Http\Middleware;
3+
namespace Pterodactyl\Http\Middleware\Activity;
44

55
use Closure;
66
use Illuminate\Http\Request;
77
use Pterodactyl\Facades\LogTarget;
88

9-
class AccountActivitySubject
9+
class AccountSubject
1010
{
1111
/**
1212
* Sets the actor and default subject for all requests passing through this

app/Http/Middleware/ServerActivitySubject.php renamed to app/Http/Middleware/Activity/ServerSubject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Pterodactyl\Http\Middleware;
3+
namespace Pterodactyl\Http\Middleware\Activity;
44

55
use Closure;
66
use Illuminate\Http\Request;
77
use Pterodactyl\Models\Server;
88
use Pterodactyl\Facades\LogTarget;
99

10-
class ServerActivitySubject
10+
class ServerSubject
1111
{
1212
/**
1313
* Attempts to automatically scope all of the activity log events registered

app/Models/ApiKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @property int $id
1414
* @property int $user_id
1515
* @property int $key_type
16-
* @property string|null $identifier
16+
* @property string $identifier
1717
* @property string $token
1818
* @property array|null $allowed_ips
1919
* @property string|null $memo

config/app.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,5 +239,10 @@
239239
'URL' => Illuminate\Support\Facades\URL::class,
240240
'Validator' => Illuminate\Support\Facades\Validator::class,
241241
'View' => Illuminate\Support\Facades\View::class,
242+
243+
// Custom Facades
244+
'Activity' => Pterodactyl\Facades\Activity::class,
245+
'LogBatch' => Pterodactyl\Facades\LogBatch::class,
246+
'LogTarget' => Pterodactyl\Facades\LogTarget::class,
242247
],
243248
];

config/ide-helper.php

Lines changed: 0 additions & 175 deletions
This file was deleted.

routes/api-client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use Illuminate\Support\Facades\Route;
44
use Pterodactyl\Http\Controllers\Api\Client;
5-
use Pterodactyl\Http\Middleware\ServerActivitySubject;
6-
use Pterodactyl\Http\Middleware\AccountActivitySubject;
5+
use Pterodactyl\Http\Middleware\Activity\ServerSubject;
6+
use Pterodactyl\Http\Middleware\Activity\AccountSubject;
77
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
88
use Pterodactyl\Http\Middleware\Api\Client\Server\ResourceBelongsToServer;
99
use Pterodactyl\Http\Middleware\Api\Client\Server\AuthenticateServerAccess;
@@ -19,7 +19,7 @@
1919
Route::get('/', [Client\ClientController::class, 'index'])->name('api:client.index');
2020
Route::get('/permissions', [Client\ClientController::class, 'permissions']);
2121

22-
Route::prefix('/account')->middleware(AccountActivitySubject::class)->group(function () {
22+
Route::prefix('/account')->middleware(AccountSubject::class)->group(function () {
2323
Route::prefix('/')->withoutMiddleware(RequireTwoFactorAuthentication::class)->group(function () {
2424
Route::get('/', [Client\AccountController::class, 'index'])->name('api:client.account');
2525
Route::get('/two-factor', [Client\TwoFactorController::class, 'index']);
@@ -54,7 +54,7 @@
5454
Route::group([
5555
'prefix' => '/servers/{server}',
5656
'middleware' => [
57-
ServerActivitySubject::class,
57+
ServerSubject::class,
5858
AuthenticateServerAccess::class,
5959
ResourceBelongsToServer::class,
6060
],

0 commit comments

Comments
 (0)