Initial PHP rebuild of the app
This commit is contained in:
690 files changed
+33944
-12046
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\Loyalty\LoyaltyService;
|
||||
use App\Services\Tenant\TenantContext;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CustomerAccountController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, TenantContext $tenant, LoyaltyService $loyalty): View
|
||||
{
|
||||
$business = $tenant->require();
|
||||
$business->loadMissing(['staff.user', 'serviceCategories.services']);
|
||||
$profile = $request->user()->customerProfiles()
|
||||
->where('businessId', $business->id)
|
||||
->first();
|
||||
|
||||
$appointments = $profile?->appointments()
|
||||
->with(['staff.user', 'services.service'])
|
||||
->where('startAt', '>=', now()->utc())
|
||||
->orderBy('startAt')
|
||||
->get() ?? collect();
|
||||
|
||||
$loyaltySummary = $profile ? $loyalty->summary($business, $profile) : null;
|
||||
|
||||
return view('customer.dashboard', [
|
||||
'business' => $business,
|
||||
'profile' => $profile,
|
||||
'appointments' => $appointments,
|
||||
'user' => $request->user(),
|
||||
'loyaltySummary' => $loyaltySummary,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user