SettingController.php 2 KB
<?php namespace App\Http\Controllers;

use Auth;
use Input;
// use Response;
// use App\Models\Group;
// use App\Models\Master;
// use App\Models\Record;
// use App\Models\CRMCall;
// use App\Models\CRMCallArchive;
// use App\Models\CRM;
// use App\Models\CRMCampaign;
// use App\Models\CRMList;
// use App\Jobs\KHRMSLib;
// use App\Models\Sipid;
// use App\Models\Dialline;
// use App\Models\UserLog;
// use App\Models\User;
// use App\Models\Kqueue;
use DB;
// use Log;
// use Session;
// $client='';

class SettingController extends Controller {

	public function __construct()
	{
		$this->middleware('auth');
		// $this->middleware('module_access');
	}

	public function index()
	{
		$data['userCurrentTheme'] = Auth::user()->theme;
		return view("layout.module.setting.index",$data);
	}
	
	public function create()
	{
	}
	
	public function store()
	{
		$action = Input::get("action");

		if($action=="upload")
		{
			$data['wakka'] = new KHRMSLib();
			return view("layout.module.data.upload",$data);
		}		
	}

	public function show($id)
	{
		if($id=="theme")
		{
			$userInput = Input::get("name");
			if($userInput != ""){
				$themes = explode(",",env('themes'));
				if(in_array($userInput, $themes)){
					DB::table('users')->where('id',Auth::user()->id)->update(['theme'=>$userInput]);
					$data['response'] = ["type"=>"success","message"=>"Selected theme applied, it will load automatically in second"];
					$data['userCurrentTheme'] = $userInput;
				}else{
					$data['response'] = ["type"=>"warning","message"=>"Selected theme not available"];
					$data['userCurrentTheme'] = Auth::user()->theme;
				}
			}else{
				$data['response'] = ["type"=>"warning","message"=>"Please select theme"];
				$data['userCurrentTheme'] = Auth::user()->theme;
			}
			return view("layout.module.setting.theme",$data);
		}
		
		if($id=="seatcount")
                {
			return view("layout.module.setting.seatCount");
		}
		return "";
	}

	public function edit($id)
	{
	}

	public function update($id)
	{
	}

	public function destroy($id)
	{
	}
}