Change name of avatar field in users table.

This commit is contained in:
Franz Liedke 2015-03-26 20:59:06 +01:00
parent 26146f1417
commit e5973aa161
3 changed files with 10 additions and 4 deletions

View File

@ -23,7 +23,7 @@ class CreateUsersTable extends Migration {
$table->string('password');
$table->text('bio')->nullable();
$table->text('bio_html')->nullable();
$table->string('avatar')->nullable();
$table->string('avatar_path')->nullable();
$table->dateTime('join_time')->nullable();
$table->dateTime('last_seen_time')->nullable();
$table->dateTime('read_time')->nullable();

View File

@ -46,7 +46,7 @@ class UploadAvatarCommandHandler
'target' => $this->uploadDir,
]);
$user->changeAvatarUrl($uploadName);
$user->changeAvatarPath($uploadName);
event(new AvatarWillBeUploaded($user, $command));

View File

@ -211,9 +211,15 @@ class User extends Model
return $this;
}
public function changeAvatarUrl($url)
/**
* Change the path of the user avatar.
*
* @param string $path
* @return $this
*/
public function changeAvatarPath($path)
{
$this->avatar = $url;
$this->avatar_path = $path;
$this->raise(new UserAvatarWasChanged($this));