This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

tanzania411
tanzania411

My relations are

// Acme\Account\Models\Plan
    public $belongsToMany = [
        'discounts' => [
            'Acme\Shop\Models\Discount',
            'table' => 'acme_shop_discounts_plans',
            'key'      => 'plan_id',
            'otherKey' => 'discount_id'
        ]
    ];
// Acme\Shop\Models\Category
    public $belongsToMany = [
        'discounts' => [
            'Acme\Shop\Models\Discount',
            'table'    => 'acme_shop_discounts_categories',
            'key'      => 'category_id',
            'otherKey' => 'discount_id'
        ]
    ];
// Acme\Shop\Models\Discount
    public $belongsToMany = [
        'categories' => [
            'Acme\Shop\Models\Category',
            'table'    => 'acme_shop_discounts_categories',
            'key'      => 'discount_id',
            'otherKey' => 'category_id'
        ],
        'plans' => [
            'Acme\Account\Models\Plan',
            'table'    => 'acme_shop_discounts_plans',
            'key'      => 'discount_id',
            'otherKey' => 'plan_id'
        ]
    ];

With

$categorySlug = lorem;
$planName = Ipsum;

I would like to find the appropriate discount

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.