Skip to content

Commit

Permalink
Fix product morph name in discount (#2074)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Ritson <[email protected]>
Co-authored-by: Author <[email protected]>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent f65ac69 commit 8f6966f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
use Lunar\Admin\Support\RelationManagers\BaseRelationManager;
use Lunar\Facades\ModelManifest;
use Lunar\Models\Product;

class ProductConditionRelationManager extends BaseRelationManager
Expand Down Expand Up @@ -39,9 +38,7 @@ public function getDefaultTable(Table $table): Table
->paginated(false)
->modifyQueryUsing(
fn ($query) => $query->whereIn('type', ['condition'])
->wherePurchasableType(
ModelManifest::getMorphMapKey(Product::class)
)
->wherePurchasableType(Product::morphName())
->whereHas('purchasable')
)
->headerActions([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
use Lunar\Admin\Support\RelationManagers\BaseRelationManager;
use Lunar\Facades\ModelManifest;
use Lunar\Models\Product;

class ProductLimitationRelationManager extends BaseRelationManager
Expand All @@ -33,9 +32,7 @@ public function getDefaultTable(Table $table): Table
->paginated(false)
->modifyQueryUsing(
fn ($query) => $query->whereIn('type', ['limitation', 'exclusion'])
->wherePurchasableType(
ModelManifest::getMorphMapKey(Product::class)
)
->wherePurchasableType(Product::morphName())
->whereHas('purchasable')
)
->headerActions([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
use Lunar\Admin\Support\RelationManagers\BaseRelationManager;
use Lunar\Facades\ModelManifest;
use Lunar\Models\Product;

class ProductRewardRelationManager extends BaseRelationManager
Expand Down Expand Up @@ -39,9 +38,7 @@ public function getDefaultTable(Table $table): Table
->paginated(false)
->modifyQueryUsing(
fn ($query) => $query->whereIn('type', ['reward'])
->wherePurchasableType(
ModelManifest::getMorphMapKey(Product::class)
)
->wherePurchasableType(Product::morphName())
->whereHas('purchasable')
)
->headerActions([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
use Lunar\Admin\Support\RelationManagers\BaseRelationManager;
use Lunar\Facades\ModelManifest;
use Lunar\Models\Product;
use Lunar\Models\ProductVariant;

Expand Down Expand Up @@ -35,9 +34,7 @@ public function getDefaultTable(Table $table): Table
->paginated(false)
->modifyQueryUsing(
fn ($query) => $query->whereIn('type', ['limitation', 'exclusion'])
->wherePurchasableType(
ModelManifest::getMorphMapKey(ProductVariant::class)
)
->wherePurchasableType(ProductVariant::morphName())
->whereHas('purchasable')
)
->headerActions([
Expand Down

0 comments on commit 8f6966f

Please sign in to comment.