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
- {
- private $_Steam;
- public $_LocalInventory;
- public function __construct()
- {
- $this->_Steam = new \App\Http\Steam();
- }
- /**
- * Constructor for index page
- *
- * @return mixed View blade template with data's
- */
- public function index()
- {
- if( $this->_Steam->IsUserLoggedIn() == false )
- return redirect('/');
- $application = new ApplicationController();
- $api = new ApiController();
- return view('site.profile')
- ->with('app', \App\Application::all())
- ->with('case', \App\Cases::all())
- ->with('client', $this)
- ->with('steam', $this->_Steam)
- ->with('application', $application)
- ->with('api', $api)
- ->with('localinventory', $this->_LocalInventory)
- ->with('steaminventory', $application->_SteamInventory);
- }
- /**
- * Getting client data's from database
- *
- * @param int id Unique Steam64 ID
- * @param mixed data Selected data to fetch
- * @param bool json Is selecting from json or not
- * @return string Fetched data
- */
- 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 client is logged
- *
- * @param string ip Real client ip (HTTP_CF_CONNECTING_IP)
- * @return bool true/false
- */
- public static function isLogged($ip)
- {
- return count(\App\LoggedUser::where('ip', '=', $ip)->count()) > 0 ? true : false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement