Skip to content

Commit

Permalink
Use variables model defined in config (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell authored Oct 28, 2024
1 parent 28f40ec commit a346490
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Globals/GlobalVariablesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GlobalVariablesRepository extends StacheRepository
public function all(): VariablesCollection
{
return VariablesCollection::make(
VariablesModel::all()
app('statamic.eloquent.global_set_variables.model')::all()
->each(function ($model) {
return app(Variables::class)::fromModel($model);
})
Expand All @@ -23,7 +23,7 @@ public function find($id): ?Variables
{
$id = Str::split($id, '::');

$model = VariablesModel::query()
$model = app('statamic.eloquent.global_set_variables.model')::query()
->where('handle', $id[0])
->when(count($id) > 1, function ($query) use ($id) {
$query->where('locale', $id[1]);
Expand All @@ -40,7 +40,7 @@ public function find($id): ?Variables
public function whereSet($handle): VariablesCollection
{
return VariablesCollection::make(
VariablesModel::query()
app('statamic.eloquent.global_set_variables.model')::query()
->where('handle', $handle)
->get()
->map(function ($model) {
Expand Down

0 comments on commit a346490

Please sign in to comment.