osb/app/Http/Controllers/UserHomeController.php

44 lines
900 B
PHP
Raw Normal View History

2018-05-20 12:53:14 +00:00
<?php
namespace App\Http\Controllers;
2018-07-13 04:53:44 +00:00
use Illuminate\Support\Facades\Auth;
2018-05-20 12:53:14 +00:00
class UserHomeController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function home()
{
2018-07-13 04:53:44 +00:00
switch (Auth::user()->role()) {
2018-07-31 04:11:00 +00:00
case 'customer':
2018-07-17 04:10:40 +00:00
return View('userhome',['o'=>Auth::user()]);
2018-07-13 04:53:44 +00:00
2018-07-31 04:11:00 +00:00
case 'reseller':
2018-07-17 04:10:40 +00:00
return View('resellerhome',['o'=>Auth::user()]);
2018-07-13 04:53:44 +00:00
2018-07-31 04:11:00 +00:00
case 'wholesaler':
2018-07-17 04:10:40 +00:00
return View('resellerhome',['o'=>Auth::user()]);
2018-07-13 04:53:44 +00:00
default:
2018-07-31 04:11:00 +00:00
abort(500,'Unknown role: '.Auth::user()->role());
2018-07-13 04:53:44 +00:00
}
2018-05-20 12:53:14 +00:00
}
2018-07-16 05:06:43 +00:00
/**
* Helper to redirect to the old site, when functions are not available in this one.
*
* @param $type
* @param $action
* @param $id
* @return void
* @deprecated @todo Remove once all functions added
*/
public function oldsite($type,$action,$id)
{
abort(307,sprintf('http://www.graytech.net.au/u/%s/%s/%s',$type,$action,$id));
}
2018-05-20 12:53:14 +00:00
}