-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDashboardController.php
More file actions
38 lines (35 loc) · 1.23 KB
/
DashboardController.php
File metadata and controls
38 lines (35 loc) · 1.23 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
<?php
namespace App\Http\Controllers;
use App\Models\Network;
use Auth;
use Illuminate\Http\Request;
use Inertia\Inertia;
class DashboardController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Inertia\Response
*/
public function index()
{
return Inertia::render('Dashboard/Index', [
'newHosts' => Network::whereUser(Auth::id())->rightJoin('network_ips', 'networks.id', '=', 'network_ips.network_id')->orderByDesc('created_at')->limit(5)->get([
'networks.name as network_name',
'network_ips.network_id',
'network_ips.name',
'network_ips.address',
'network_ips.created_at',
'network_ips.updated_at',
]),
'updatedHosts' => Network::whereUser(Auth::id())->rightJoin('network_ips', 'networks.id', '=', 'network_ips.network_id')->orderByDesc('updated_at')->limit(5)->get([
'networks.name as network_name',
'network_ips.network_id',
'network_ips.name',
'network_ips.address',
'network_ips.created_at',
'network_ips.updated_at',
]),
]);
}
}