Skip to content

Commit

Permalink
fix: accessing settings during database reset causes error (resolves #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jobara authored Feb 12, 2024
1 parent 4366082 commit 700eeca
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/RefreshDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handle()
return 1;
}

$this->call('down');
$this->call('down', ['--render' => 'errors::503']);
$this->call('migrate:fresh', ['--seeder' => 'DevSeeder']);
$this->call('up');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Notifications/AccountSuspended.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function toVonage(): VonageMessage
__('Your account on the Accessibility Exchange has been suspended.').' '.$this->getCapabilities($this->account).' '.__('Please contact us at :email or :phone if you need further assistance.',
[
'email' => settings('email'),
'phone' => phone(settings('phone'), 'CA')->formatForCountry('CA'),
'phone' => phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA'),
]
)
)
Expand Down
2 changes: 1 addition & 1 deletion app/Notifications/AccountUnsuspended.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function toVonage(): VonageMessage
__('Your account on the Accessibility Exchange is no longer suspended.').' '.$this->getCapabilities($this->account).' '.__('Please contact us at :email or :phone if you need further assistance.',
[
'email' => settings('email'),
'phone' => phone(settings('phone'), 'CA')->formatForCountry('CA'),
'phone' => phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA'),
]
)
)
Expand Down
5 changes: 5 additions & 0 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Routing\Route;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Route as RouteFacade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;

Expand All @@ -17,6 +18,10 @@
*/
function settings(?string $key = null, mixed $default = null): mixed
{
if (! Schema::hasTable('settings')) {
return $default;
}

return app(GeneralSettings::class)->$key ?? $default;
}
}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/layouts/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
'</a>',
]) }}
</h3>
<p>{{ phone(settings('phone'), 'CA')->formatForCountry('CA') }}</p>
<p>{{ phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA') }}</p>
<h3>{{ __('Mailing Address') }}</h3>
{{ safe_nl2br(settings('address')) }}
{{ safe_nl2br(settings('address', '')) }}
</address>
</div>
<nav class="stack" aria-labelledby="social">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/contact-information.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
htmlentities(__('VRS')) .
'</a>',
]) }}:</strong>
{{ phone(settings('phone'), 'CA')->formatForCountry('CA') }}
{{ phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA') }}
</p>
2 changes: 1 addition & 1 deletion resources/views/partials/have-more-questions.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p class="h3">
{{ __('Have more questions?') }}<br />
{{ __('Call our support line at :number', ['number' => phone(settings('phone'), 'CA')->formatForCountry('CA')]) }}
{{ __('Call our support line at :number', ['number' => phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA')]) }}
</p>
<x-interpretation class="interpretation--center" name="{{ __('Have more questions?', [], 'en') }}" namespace="questions" />
2 changes: 1 addition & 1 deletion resources/views/partials/help-bar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class="font-semibold">{{ safe_inlineMarkdown('Call or :!vrs', [
'<a href="https://srvcanadavrs.ca/en/resources/resource-centre/vrs-basics/register/" rel="external">' .
htmlentities(__('VRS')) .
'</a>',
]) }}:</span>&nbsp;{{ phone(settings('phone'), 'CA')->formatForCountry('CA') }}
]) }}:</span>&nbsp;{{ phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA') }}
</div>
<div>
@svg('heroicon-o-envelope')&nbsp;<span class="font-semibold">{{ __('Email') }}:</span>&nbsp;<a
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/join.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
<div class="stack">
<h3>{{ __('Sign up on the phone') }}</h3>
<p>{{ __('Call our support line at :number', ['number' => phone(settings('phone'), 'CA')->formatForCountry('CA')]) }}
<p>{{ __('Call our support line at :number', ['number' => phone(settings('phone', '+1-888-867-0053'), 'CA')->formatForCountry('CA')]) }}
</p>
</div>
@if ($withPricing ?? false)
Expand Down

0 comments on commit 700eeca

Please sign in to comment.