|
26 | 26 |
|
27 | 27 | use Carbon; |
28 | 28 | use Pterodactyl\Events; |
29 | | -use Pterodactyl\Models; |
30 | 29 | use Pterodactyl\Models\Server; |
31 | 30 | use Pterodactyl\Jobs\DeleteServer; |
32 | 31 | use Pterodactyl\Jobs\SuspendServer; |
@@ -59,20 +58,14 @@ public function created(Server $server) |
59 | 58 | event(new Events\Server\Created($server)); |
60 | 59 |
|
61 | 60 | // Queue Notification Email |
62 | | - $user = Models\User::findOrFail($server->owner_id); |
63 | | - $node = Models\Node::select('name')->where('id', $server->node_id)->first(); |
64 | | - $service = Models\Service::select('services.name', 'service_options.name as optionName') |
65 | | - ->join('service_options', 'service_options.service_id', '=', 'services.id') |
66 | | - ->where('services.id', $server->service_id) |
67 | | - ->where('service_options.id', $server->option_id) |
68 | | - ->first(); |
| 61 | + $server->load('user', 'node', 'service.option'); |
69 | 62 |
|
70 | | - $user->notify((new ServerCreated([ |
| 63 | + $server->user->notify((new ServerCreated([ |
71 | 64 | 'name' => $server->name, |
72 | 65 | 'memory' => $server->memory, |
73 | | - 'node' => $node->name, |
74 | | - 'service' => $service->name, |
75 | | - 'option' => $service->optionName, |
| 66 | + 'node' => $server->node->name, |
| 67 | + 'service' => $server->service->name, |
| 68 | + 'option' => $server->service->option->name, |
76 | 69 | 'uuidShort' => $server->uuidShort, |
77 | 70 | ]))); |
78 | 71 | } |
|
0 commit comments