ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Model Function Issue #24

Closed ghost closed 10 years ago

ghost commented 10 years ago

For some reason when I created functions within one of the User models, they are not firing when the model is read/saved.

I added a function to handle multiple select boxe values as follows...

public function setPermissionsAttribute( $value )
{
    $this->attributes['permissions'] = json_encode( $value );
}

public function getPermissionsAttribute( $value )
{
    return json_decode( $value );
}

Is it still possible to do this? Thank you!

ollieread commented 10 years ago

I'm not sure what this has to do with my package? Those are mutators and accessors which are part of the laravel core code, and not specific to this package.

ghost commented 10 years ago

Yeah, i know... just for some reason after installing your package they quit working... :(

ollieread commented 10 years ago

I don't touch the Eloquent classes so my package wouldn't affect this, although your getPermissionsAttribute method is wrong.

public function getPermissionsAttribute()
{
    return json_decode($this->attributes['permissions']);
}
ghost commented 10 years ago

Ok, well, I will look further into it.