Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- class ClientController extends Controller
- {
- /**
- * @var \App\Http\Steam The Steam class instance
- */
- private $_Steam;
- /**
- * @var array
- */
- public $_LocalInventory;
- public function __construct()
- {
- // Initializing an Steam class
- $this->_Steam = new \App\Http\Steam();
- }
- /**
- * The constructor for an index page
- *
- * @return Illuminate\Support\Facades\View
- */
- public function index()
- {
- if( !$this->isLogged() )
- return redirect('/');
- $this->_LocalInventory = \App\Client::where('steamid', '=', $_SESSION['steamID64'])->value('inventory');
- $application = new ApplicationController();
- $steamController = new SteamController();
- return view('site.profile')
- ->with('app', \App\Application::all())
- ->with('application', $application)
- ->with('case', \App\Cases::all())
- ->with('client', $this)
- ->with('localinventory', $this->_LocalInventory)
- ->with('steam', $this->_Steam)
- ->with('steamController', $steamController)
- ->with('steaminventory', '[]'); // TODO: Make an request for user inventory on Steam
- }
- /**
- * Getting an client data from a database
- *
- * @param int $steamid Unique Steam64 ID
- * @param mixed $data Data, which will be fetched from a database
- * @param bool|true $json Selector, if data's are in json
- * @return string
- */
- public function GetClient($steamid, $data, $json = true)
- {
- if( $json == true )
- return json_decode( \App\Client::where('steamid', '=', $steamid)->get()[0]['data'] )->$data;
- else
- return \App\Client::select($data)->where('steamid', $steamid)->value($data);
- }
- /**
- * Checking if a client is logged
- *
- * @return bool
- */
- public static function isLogged()
- {
- return isset($_SESSION['steamID64']) ? true : false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement