Move User model to Models/

This commit is contained in:
Deon George
2021-06-29 13:18:52 +10:00
parent 8899ade36b
commit 638472fb4f
29 changed files with 94 additions and 102 deletions

View File

@@ -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());
}
}