/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(Request $request) { $account = new Accounts(); $account->email = $request['email']; $account->MD5Password = md5($this->salt . $request['password']); $account->AccountStatus = 100; $account->IsDeveloper = 0; $account->ReferralID = 0; $account->dateregistered = (new \DateTime())->format('Y-m-d H:i:s'); $account->save(); $user = new UsersData(); $user->CustomerID = $account->CustomerID; $user->AccountStatus = 100; $user->IsDeveloper = 0; $user->AccountType = 2; $user->GamePoints = 0; $user->GameDollars = 0; $user->dateregistered = (new \DateTime())->format('Y-m-d H:i:s'); $user->lastjoineddate = '1973-01-01 00:00:00.000'; $user->lastgamedate = '1973-01-01 00:00:00.000'; $user->ClanID = 0; $user->ClanRank = 99; $user->CharsCreated = 0; $user->TimePlayed = 0; $user->DateActiveUntil = '2030-01-01 00:00:00.000'; $user->BanCount = 0; $user->save(); 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'); }
/** * Ban the specified resource from storage. * * @param int $id * @return Response */ public function ban($id, Request $request) { $accountsEffected = Accounts::where('CustomerID', $id)->update(['AccountStatus' => $request->input('AccountStatus')]); $usersEffected = UsersData::where('CustomerID', $id)->update(['AccountStatus' => $request->input('AccountStatus'), 'BanReason' => $request->input('BanReason'), 'BanTime' => (new \DateTime())->format('Y-m-d H:i:s')]); if ($usersEffected >= 1 && $accountsEffected >= 1) { return redirect()->action('AccountsController@show', ['success' => true, 'id' => $id]); } else { return redirect()->action('AccountsController@show', ['success' => false, 'id' => $id]); } }