Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Runtime Table Aliassing #2737

Open
wants to merge 9 commits into
base: 3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Models/Block.php
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ public function getPresenterAttribute()

public function getTable()
{
return config('twill.blocks_table', 'twill_blocks');
return $this->table ?? config('twill.blocks_table', 'twill_blocks');
}

public function scopePublished(Builder $query): Builder
2 changes: 1 addition & 1 deletion src/Models/Feature.php
Original file line number Diff line number Diff line change
@@ -36,6 +36,6 @@ public static function getForBucket(string $bucketKey): Collection

public function getTable(): string
{
return config('twill.features_table', 'twill_features');
return $this->table ?? config('twill.features_table', 'twill_features');
}
}
2 changes: 1 addition & 1 deletion src/Models/File.php
Original file line number Diff line number Diff line change
@@ -47,6 +47,6 @@ public function toCmsArray()

public function getTable()
{
return config('twill.files_table', 'twill_files');
return $this->table ?? config('twill.files_table', 'twill_files');
}
}
2 changes: 1 addition & 1 deletion src/Models/Media.php
Original file line number Diff line number Diff line change
@@ -168,6 +168,6 @@ public function delete()

public function getTable()
{
return config('twill.medias_table', 'twill_medias');
return $this->table ?? config('twill.medias_table', 'twill_medias');
}
}
2 changes: 1 addition & 1 deletion src/Models/RelatedItem.php
Original file line number Diff line number Diff line change
@@ -24,6 +24,6 @@ public function subject()

public function getTable()
{
return config('twill.related_table', 'twill_related');
return $this->table ?? config('twill.related_table', 'twill_related');
}
}
2 changes: 1 addition & 1 deletion src/Models/Setting.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public function getTranslationModelNameDefault()

public function getTable()
{
return config('twill.settings_table', 'twill_settings');
return $this->table ?? config('twill.settings_table', 'twill_settings');
}

protected function getTranslationRelationKey(): string
2 changes: 1 addition & 1 deletion src/Models/Tag.php
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ class Tag extends IlluminateTag

public function getTable()
{
return config('twill.tags_table', 'tags');
return $this->table ?? config('twill.tags_table', 'tags');
}
}
2 changes: 1 addition & 1 deletion src/Models/Tagged.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@ class Tagged extends IlluminateTagged
{
public function getTable()
{
return config('twill.tagged_table', 'tagged');
return $this->table ?? config('twill.tagged_table', 'tagged');
}
}