Work on Service rendering
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||
|
||||
use App\Models\{Invoice,Service};
|
||||
use App\User;
|
||||
use PDF;
|
||||
|
||||
class UserHomeController extends Controller
|
||||
{
|
||||
@@ -15,7 +16,12 @@ class UserHomeController extends Controller
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function home()
|
||||
/**
|
||||
* Logged in users home page
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function home(): View
|
||||
{
|
||||
switch (Auth::user()->role()) {
|
||||
case 'customer':
|
||||
@@ -32,11 +38,23 @@ class UserHomeController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function invoice(Invoice $o)
|
||||
/**
|
||||
* Render a specific invoice for the user
|
||||
*
|
||||
* @param Invoice $o
|
||||
* @return View
|
||||
*/
|
||||
public function invoice(Invoice $o): View
|
||||
{
|
||||
return View('u.invoice',['o'=>$o]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the invoice in PDF format, ready to download
|
||||
*
|
||||
* @param Invoice $o
|
||||
* @return mixed
|
||||
*/
|
||||
public function invoice_pdf(Invoice $o)
|
||||
{
|
||||
return PDF::loadView('u.invoice', ['o'=>$o])->stream(sprintf('%s.pdf',$o->invoice_account_id));
|
||||
@@ -56,8 +74,15 @@ class UserHomeController extends Controller
|
||||
abort(307,sprintf('http://www.graytech.net.au/u/%s/%s/%s',$type,$action,$id));
|
||||
}
|
||||
|
||||
public function service(Service $o)
|
||||
/**
|
||||
* Return details on the users service
|
||||
*
|
||||
* @param Service $o
|
||||
* @return View
|
||||
*/
|
||||
public function service(Service $o): View
|
||||
{
|
||||
return View('u.service',['o'=>$o]);
|
||||
foreach ([
|
||||
sprintf('u.service.%s.%s',$o->type->type,$o->status),
|
||||
sprintf('u.service.%s',$o->status),
|
||||
|
Reference in New Issue
Block a user