/** * Display a listing of the resource. * * @return Response */ public function index() { //dd(Auth::check()); //if (Session::has('user_id')) { $accountCount = Accounts::count(); $serials = 0; $globalInventory = UsersInventory::count(); $bannedCount = UsersData::where('AccountStatus', '>=', '200')->count(); $clanCount = ClanData::count(); $zDollarCount = UsersData::sum('GameDollars'); $charactersCount = UsersChars::count(); return view('dashboard')->with(['accountCount' => $accountCount, 'serials' => $serials, 'globalInventory' => $globalInventory, 'bannedCount' => $bannedCount, 'clanCount' => $clanCount, 'zDollarCount' => $zDollarCount, 'charactersCount' => $charactersCount]); //} //else return redirect('login'); }
public function storeGP($id) { $user = Auth::user(); $GC = UsersData::select('GamePoints')->where('CustomerID', $user->CustomerID)->first(); switch ($id) { case 0: if ($GC->GamePoints < 200) { return "You cannot afford this!"; } UsersInventory::insert(['CharID' => 0, 'BackpackSlot' => 0, 'LeasedUntil' => '2020-11-29 17:42:12.593', 'var1' => '-1', 'var2' => '-1', 'ItemID' => 20006, 'Quantity' => 100, 'CustomerID' => $user->CustomerID]); UsersInventory::insert(['CharID' => 0, 'BackpackSlot' => 0, 'LeasedUntil' => '2020-11-29 17:42:12.593', 'var1' => '-1', 'var2' => '-1', 'ItemID' => 20015, 'Quantity' => 100, 'CustomerID' => $user->CustomerID]); UsersInventory::insert(['CharID' => 0, 'BackpackSlot' => 0, 'LeasedUntil' => '2020-11-29 17:42:12.593', 'var1' => '-1', 'var2' => '-1', 'ItemID' => 101262, 'Quantity' => 200, 'CustomerID' => $user->CustomerID]); UsersInventory::insert(['CharID' => 0, 'BackpackSlot' => 0, 'LeasedUntil' => '2020-11-29 17:42:12.593', 'var1' => '-1', 'var2' => '-1', 'ItemID' => 101055, 'Quantity' => 50, 'CustomerID' => $user->CustomerID]); UsersInventory::insert(['CharID' => 0, 'BackpackSlot' => 0, 'LeasedUntil' => '2020-11-29 17:42:12.593', 'var1' => '-1', 'var2' => '-1', 'ItemID' => 101193, 'Quantity' => 50, 'CustomerID' => $user->CustomerID]); UsersData::decrement('GamePoints', 200)->where('CustomerID', $user->CustomerID); } return redirect('shop'); }