forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerDataComposer.php
More file actions
45 lines (39 loc) · 1.05 KB
/
ServerDataComposer.php
File metadata and controls
45 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\ViewComposers\Server;
use Illuminate\View\View;
use Illuminate\Contracts\Session\Session;
class ServerDataComposer
{
/**
* @var \Illuminate\Contracts\Session\Session
*/
protected $session;
/**
* ServerDataComposer constructor.
*
* @param \Illuminate\Contracts\Session\Session $session
*/
public function __construct(Session $session)
{
$this->session = $session;
}
/**
* Attach server data to a view automatically.
*
* @param \Illuminate\View\View $view
*/
public function compose(View $view)
{
$data = $this->session->get('server_data');
$view->with('server', array_get($data, 'model'));
$view->with('node', object_get($data['model'], 'node'));
$view->with('daemon_token', array_get($data, 'token'));
}
}