Move User model to Models/
This commit is contained in:
@@ -10,15 +10,21 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||
|
||||
use App\Models\{Invoice,Service};
|
||||
use App\User;
|
||||
use App\Models\{Invoice,Service,User};
|
||||
|
||||
/**
|
||||
* Class HomeController
|
||||
* This controller is the logged in users home page
|
||||
*
|
||||
* The methods to this controller should be projected by the route
|
||||
*
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// Route protection is in routes.web
|
||||
// $this->middleware('auth');
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,9 +32,10 @@ class HomeController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function home(User $o=NULL): View
|
||||
public function home(User $o): View
|
||||
{
|
||||
if ($o)
|
||||
// If we are passed a user to view, we'll open up their home page.
|
||||
if ($o->exists)
|
||||
return View('u.home',['o'=>$o]);
|
||||
|
||||
// If User was null, then test and see what type of logged on user we have
|
||||
@@ -43,7 +50,7 @@ class HomeController extends Controller
|
||||
return View('r.home',['o'=>$o]);
|
||||
|
||||
default:
|
||||
abort(500,'Unknown role: '.$o->role());
|
||||
abort(404,'Unknown role: '.$o->role());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user