Skip to content

The models defined in config/soulbscription.php are not compatible with HasSubscriptions trait #61

@mezbilisim

Description

@mezbilisim

When I define a new model for the plan in config/soulbscription.php, I cannot use some properties because these relationships are not defined in HasSubscriptions trait. For example, I can list the plans like this:

config('soulbscription.models.plan')::all();

But I can't change a plan that I have listed in this way.

$new_plan = config('soulbscription.models.plan')::find($plan_id);
$user->switchTo($new_plan);

Because dynamic relationship is not used in HasSubscriptions trait.

<?php

namespace LucasDotVin\Soulbscription\Models\Concerns;

use LucasDotVin\Soulbscription\Models\Plan;
.
.
.

trait HasSubscriptions
{

.
.
.

public function subscribeTo(Plan $plan, $expiration = null, $startDate = null): Subscription
    {
        .
        .
        .
    }
}

I want to customise the plan table. I can add price, description, currency or different discriminator fields. I can associate this model with my invoices. I want to make many more customisations like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions