<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2017/12/1
 * Time: 11:37
 */

namespace App\Http\Controllers\Manage\Web;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class WelcomeController extends Controller
{

    public function index(Request $request)
    {
    	$domain = _domain();
    	$options = [];
    
    	if(session('manage_user'))
    	{
    		$manage_user = unserialize(session('manage_user'));
//     		var_dump('$manage_user_sesiral');var_dump($manage_user);
    		$options =[
	    		'role'=>isset($manage_user['role'])?$manage_user['role']:''
    		];
    	}
//     	$options =[
//     	  'role'=>'admin'
//     	];
//     	var_dump('$options');var_dump($options);
    	$options = json_encode($options);
//     	var_dump('$options');var_dump($options);die();
    
    	return view('manage.web.welcome.index',compact('options'));
    }
    
    public function logout(Request $request)
    {
    	$request->session()->forget('manage_auth');
    	$request->session()->forget('manage_user');
    	return redirect()->to('/');
    }
    
    public function get_session(Request $request)
    {
    	var_dump('manage_auth');
    	var_dump(session('manage_auth'));
    	var_dump('manage_user');
    	var_dump(session('manage_user'));
    }


}