diff options
Diffstat (limited to 'app/User.php')
| -rw-r--r-- | app/User.php | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/app/User.php b/app/User.php index 3c1799d..dda14ca 100644 --- a/app/User.php +++ b/app/User.php @@ -28,6 +28,8 @@ class User extends Model implements Authenticatable {  	public $timestamps = false;  	protected $fillable = ['email', 'name']; +	const VOTE_WEIGHT_BASE = 5; +  	public function changePoints($kind, $change, $verb = null) {  		$change = new PointChange;  		$change->user = $this->id; @@ -40,6 +42,13 @@ class User extends Model implements Authenticatable {  		$this->save();  	} +	public function voteWeight() { +		if ($this->points <= 0) +			return 0; + +		return floor(log($this->points, self::VOTE_WEIGHT_BASE)); +	} +  	public function setPasswordAttribute($pass) {  		$this->attributes['password'] = Hash::make($pass);  	} | 
