Skip to content

Commit

Permalink
Add site database table exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jhhazelaar committed Nov 5, 2024
1 parent 65806da commit 814bbb2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Sites/Sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
namespace Statamic\Eloquent\Sites;

use Statamic\Support\Str;
use Illuminate\Support\Facades\Schema;

class Sites extends \Statamic\Sites\Sites
{
protected function getSavedSites()
{
$sitesTable = config('statamic.eloquent-driver.table_prefix', '').'entries';
if(! Schema::hasTable($sitesTable)) {
return $this->getFallbackConfig();
};

$sites = app('statamic.eloquent.sites.model')::all();

return $sites->isEmpty() ? $this->getFallbackConfig() : $sites->mapWithKeys(function ($model) {
Expand Down

0 comments on commit 814bbb2

Please sign in to comment.