Sommer Style, Avatare, Duplikate
This commit is contained in:
@@ -51,6 +51,30 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function getAvatar() {
|
||||
if($avatar = $this->getSetting('avatar')) {
|
||||
return asset('img/avatars/'.$avatar);
|
||||
} else {
|
||||
return asset('img/no-avatar.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
public function getSetting($key, $false = false) {
|
||||
$settings = json_decode($this->settings);
|
||||
if(!is_null($settings))
|
||||
return $settings->$key;
|
||||
else
|
||||
return $false;
|
||||
}
|
||||
|
||||
public function setSetting($key, $value) {
|
||||
$settings = json_decode($this->settings);
|
||||
if(!is_null($settings)) {
|
||||
$settings = array();
|
||||
}
|
||||
$settings[$key] = $value;
|
||||
$this->settings = json_encode($settings);
|
||||
}
|
||||
|
||||
public function films() {
|
||||
return $this->hasMany('Film', 'user');
|
||||
|
||||
Reference in New Issue
Block a user