osb/app/Http/Controllers/UserHomeController.php
2018-07-17 14:10:40 +10:00

44 lines
900 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
class UserHomeController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function home()
{
switch (Auth::user()->role()) {
case 'Customer':
return View('userhome',['o'=>Auth::user()]);
case 'Reseller':
return View('resellerhome',['o'=>Auth::user()]);
case 'Wholesaler':
return View('resellerhome',['o'=>Auth::user()]);
default:
abort(500,'Unknown role: ',Auth::user()->role());
}
}
/**
* 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));
}
}