Update server observer to use new model code.
This commit is contained in:
parent
53cd32aac8
commit
24a8bfab97
1 changed files with 5 additions and 12 deletions
|
@ -26,7 +26,6 @@ namespace Pterodactyl\Observers;
|
|||
|
||||
use Carbon;
|
||||
use Pterodactyl\Events;
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Jobs\DeleteServer;
|
||||
use Pterodactyl\Jobs\SuspendServer;
|
||||
|
@ -59,20 +58,14 @@ class ServerObserver
|
|||
event(new Events\Server\Created($server));
|
||||
|
||||
// Queue Notification Email
|
||||
$user = Models\User::findOrFail($server->owner_id);
|
||||
$node = Models\Node::select('name')->where('id', $server->node_id)->first();
|
||||
$service = Models\Service::select('services.name', 'service_options.name as optionName')
|
||||
->join('service_options', 'service_options.service_id', '=', 'services.id')
|
||||
->where('services.id', $server->service_id)
|
||||
->where('service_options.id', $server->option_id)
|
||||
->first();
|
||||
$server->load('user', 'node', 'service.option');
|
||||
|
||||
$user->notify((new ServerCreated([
|
||||
$server->user->notify((new ServerCreated([
|
||||
'name' => $server->name,
|
||||
'memory' => $server->memory,
|
||||
'node' => $node->name,
|
||||
'service' => $service->name,
|
||||
'option' => $service->optionName,
|
||||
'node' => $server->node->name,
|
||||
'service' => $server->service->name,
|
||||
'option' => $server->service->option->name,
|
||||
'uuidShort' => $server->uuidShort,
|
||||
])));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue