HRController.php 1.55 KB
<?php namespace App\Http\Controllers;

use Input;
use App\Jobs\KHRMSLib;
use App\Models\Cutoff;
use Auth;
use Response;

class HRController extends Controller {

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

	public function index()
	{
            $data=array();
            $data['wakka'] = new KHRMSLib();
            return view('layout.module.hr.index',$data);
	}
	public function create()
	{
		//
	}
	public function store()
	{
        if(Input::get('action') == "CutOff"){
        	//change start code
			$cutoff = new Cutoff();
			$cutoff->starttime=Input::get("cutoffstarttime");
			$cutoff->endtime=Input::get("cutoffendtime");
			$cutoff->user_id=Auth::user()->id;
			$cutoff->save();
			return Response::make("<script>simpleNotification('success','topRight','Cutoff added successfully!');</script>");
			//change end code
		}else{
            $data=array();
            $data['wakka'] = new KHRMSLib();
            return view('layout.module.hr.'.strtolower(Input::get('action')),$data);
        }
	}
	public function show($id)
	{
		$data=array();
		$data['wakka'] = new KHRMSLib();

		$type='text/html';
		if($id=='IDCard')$type="image/png";
		if($id=='SalarySlip')$type="application/pdf";
		if($id=='IncentiveSlip')$type="application/pdf";

		return response()->view('layout.module.hr.'.strtolower($id),$data)->header('Content-Type', $type);
	}
	public function edit($id)
	{
		//
	}
	public function update($id)
	{
		//
	}
	public function destroy($id)
	{
		//
	}


	public function dashboard()
	{
		//echo "OK";
	}
}