1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Http\Controllers;
- use App\Models\Egg;
- use App\Models\Product;
- use App\Models\UsefulLink;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- class HomeController extends Controller
- {
- public function __construct()
- {
- $this->middleware('auth');
- }
- /** Show the application dashboard. */
- public function index(Request $request)
- {
- dd(Product::first()->nodes()->get() , Product::first()->eggs()->get());
- $usage = 0;
- foreach (Auth::user()->servers as $server){
- $usage += $server->product->price;
- }
- return view('home')->with([
- 'useage' => $usage,
- 'useful_links' => UsefulLink::all()->sortBy('id')
- ]);
- }
- }
|