Skip to content

Unable to override trait property #2

Closed

Description

@ebernie

The example give to enable cache bursting & modifying TTL from within the case implementing the trait doesn't work. Am I missing something?

Activity

  1. SimplyCorey commented on Dec 20, 2016

    @SimplyCorey
    Member

    Can I see your model please?

    Just a quick note -- I haven't finished testing this package yet. I plan on finishing up testing over the next few days and then releasing 1.0

  2. ebernie commented on Dec 20, 2016

    @ebernie
    Author

    Here you go.

    class State extends Model {
    
        use Cacheable;
        protected $cacheBusting = true;
    
        protected $table = 'states';
    
        protected $fillable = [ 'country_id','name'];
    
        public $timestamps = false;
    
        public static function register(array $attribute)
        {
            return new static($attribute);
        }
    
    }

    Gives me the following error.

    App\State and App\Traits\Cacheable define the same property ($cacheBusting) in the composition of App\State. However, the definition differs and is considered incompatible. Class was composed

    I forgot to mention that to test out the code, I copied the individual files into my project instead of installing through composer. Does this make any difference?

  3. self-assigned this
    on Dec 20, 2016
  4. added this to the 1.0 milestone on Dec 20, 2016
  5. SimplyCorey commented on Dec 20, 2016

    @SimplyCorey
    Member

    Fixed in latest master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions