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

Some Traits isnt working when using CachedModel #41

Closed
nickaguilarh opened this issue Dec 16, 2017 · 1 comment
Closed

Some Traits isnt working when using CachedModel #41

nickaguilarh opened this issue Dec 16, 2017 · 1 comment

Comments

@nickaguilarh
Copy link

nickaguilarh commented Dec 16, 2017

Issue

I have a model, Userwhich extends CachedModel:

class User extends CachedModel
{
}

Same model use Traits like Notifiable, Sluggable and CanFollow from package laravel-follow

class User extends CachedModel
{
    use Notifiable, Sluggable, CanFollow, CanBeFollowed, CanLike, CanFavorite, CanSubscribe, EntrustUserTrait;

    /**

The problem is that when User odel extends CachedModel, User model cant access the traits. I just realized that when i re-seeded an ongoing proyect.

>php artisan db:seed --class=LikesFollowersSeeder

In Builder.php line 2459:

  Call to undefined method Illuminate\Database\Query\Builder::subscribe()

Environment

Laravel Version: 5.5.25
Laravel Model Caching Package Version: 0.2.12
PHP Version: 7.2.0
Homestead Version: N/A
Operating System & Version: Windows 10 64bits same on Ubuntu 16.04

@mikebronner
Copy link
Owner

Yes, the User model is a special case. I have not cached that model in my projects because of this, and because I always want the latest user data pulled from the database. It's probably not a good idea to cache the user model.

I will add some documentation for that, thanks for raising the issue! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants