@php
$host = request()->getHttpHost();
// Attempt to find the domain associated with the host
$domain = \Stancl\Tenancy\Database\Models\Domain::where('domain', $host)->first();
// Initialize $tenant and $planEndsAt with default values
$tenant = null;
$planEndsAt = null;
if ($domain) {
// If a domain is found, attempt to find the tenant associated with it
$tenant = \App\Models\Tenant::where('id', $domain->tenant_id)->first();
if ($tenant && $tenant->plan_ends_at) {
// Parse the plan end date if it exists
$planEndsAt = \Carbon\Carbon::parse($tenant->plan_ends_at)->timestamp;
}
}
@endphp