bpuig / laravel-subby

Laravel Plan and Subscriptions manager.
https://bpuig.github.io/laravel-subby
MIT License
104 stars 42 forks source link

App\Models\User::activeSubscriptions must return a relationship instance. #146

Open sajjad-talebi opened 2 years ago

sajjad-talebi commented 2 years ago

When I want to check the user's active subscription with this method I am facing the following problem

$user->activeSubscriptions

link

If I apply with this method, it works correctly $user->activeSubscriptions()

Can a user have multiple active subscriptions? If the answer is negative, this method should return boolean

Thanks for your nice package

bpuig commented 2 years ago

In theory, it can. Since this package was orginally forked, maybe some things don't work as expected. I'll take a look

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rehmankhalil1001 commented 1 year ago

getting this error, using laravel 10 with laravel-subby v7.0

LogicException: App\Models\User::activeSubscriptions must return a relationship instance. in file /Users/apple/Desktop/php/convertpods-latest/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 583

0 /Users/apple/Desktop/php/convertpods-latest/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(526): Illuminate\Database\Eloquent\Model->getRelationshipFromMethod('activeSubscript...')

1 /Users/apple/Desktop/php/convertpods-latest/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php(451): Illuminate\Database\Eloquent\Model->getRelationValue('activeSubscript...')

2 /Users/apple/Desktop/php/convertpods-latest/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2227): Illuminate\Database\Eloquent\Model->getAttribute('activeSubscript...')

3 /Users/apple/Desktop/php/convertpods-latest/app/Http/Controllers/UserController.php(243): Illuminate\Database\Eloquent\Model->__get('activeSubscript...')

Any luck on resolving this?