1
0
mirror of https://github.com/flarum/core.git synced 2025-07-25 18:51:40 +02:00

Add avatar handling to user model.

This commit is contained in:
Franz Liedke
2015-03-25 14:21:50 +01:00
parent 901b6b0839
commit 7f66a77ede
3 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?php namespace Flarum\Core\Events;
use Flarum\Core\Models\User;
class UserAvatarWasChanged
{
public $user;
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -10,6 +10,7 @@ use Flarum\Core\Events\UserWasRenamed;
use Flarum\Core\Events\UserEmailWasChanged;
use Flarum\Core\Events\UserPasswordWasChanged;
use Flarum\Core\Events\UserBioWasChanged;
use Flarum\Core\Events\UserAvatarWasChanged;
use Flarum\Core\Events\UserWasActivated;
use Flarum\Core\Events\UserEmailWasConfirmed;
@@ -210,6 +211,15 @@ class User extends Model
return $this;
}
public function changeAvatarUrl($url)
{
$this->avatar = $url;
$this->raise(new UserAvatarWasChanged($this));
return $this;
}
/**
* Check if a given password matches the user's password.
*