Skip to content

Commit

Permalink
enforce morph map
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Nov 8, 2024
1 parent ec75b6e commit dbdd7db
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\ScheduledJob;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\QueryException;
use Illuminate\Support\Number;
use Illuminate\Support\ServiceProvider;
Expand Down Expand Up @@ -39,6 +40,8 @@ public function boot(): void

Number::useLocale($this->app->getLocale());

$this->enforceMorphMap();

$this->resolveSchedule();

$this->setSeoDefaults();
Expand All @@ -51,6 +54,21 @@ protected function registerStrMacros(): void
->join(''));
}

protected function enforceMorphMap(): void
{
Relation::enforceMorphMap([
'candidate' => \App\Models\Candidate::class,
'country' => \App\Models\Country::class,
'county' => \App\Models\County::class,
'election' => \App\Models\Election::class,
'locality' => \App\Models\Locality::class,
'party' => \App\Models\Party::class,
'record' => \App\Models\Record::class,
'turnout' => \App\Models\Turnout::class,
'user' => \App\Models\User::class,
]);
}

protected function setSeoDefaults(): void
{
seo()
Expand Down

0 comments on commit dbdd7db

Please sign in to comment.