PHP Rebuild
CI / ci (push) Canceled after 0s

Initial PHP rebuild of the app
This commit is contained in:
Stefan Lazic committed 2026-09-05 08:21:33 +01:00
1 parent 8a2b211069
commit 2ef3654841
690 files changed
+33944 -12046

No files matched your search

@@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers;
use App\Enums\Permission;
use App\Models\Appointment;
use App\Services\Tenant\TenantContext;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\View\View;
class StaffDashboardController extends Controller
{
public function __invoke(Request $request, TenantContext $tenant): View
{
$business = $tenant->require();
$staff = $request->user()->staffProfiles()
->where('businessId', $business->id)
->with('role.permissions')
->first();
abort_unless($staff, 403);
$isOwner = $staff->hasPermission(Permission::ViewAllStaffAppointments);
$today = Carbon::now($business->timezone);
$appointments = Appointment::query()
->where('businessId', $business->id)
->when(! $isOwner, fn ($query) => $query->where('staffId', $staff->id))
->whereBetween('startAt', [$today->copy()->startOfDay()->utc(), $today->copy()->endOfDay()->utc()])
->with(['customer', 'staff.user', 'services.service'])
->orderBy('startAt')
->get();
return view('staff.dashboard', compact('business', 'staff', 'appointments', 'isOwner'));
}
}