Skip to content

Commit

Permalink
Prevent querying for table columns multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Oct 11, 2024
1 parent 3bb5f01 commit 67d4d89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Statamic\Facades\Blink;
use Statamic\Facades\Search;
use Statamic\Fields\Blueprint;
use Statamic\Fields\Field;
Expand Down Expand Up @@ -241,7 +242,9 @@ public function databaseTable(): string

public function databaseColumns(): array
{
return Schema::getColumnListing($this->databaseTable());
return Blink::once('runway-database-columns-'.$this->databaseTable(), function () {
return Schema::getColumnListing($this->databaseTable());
});
}

public function revisionsEnabled(): bool
Expand Down

0 comments on commit 67d4d89

Please sign in to comment.