mirror of
https://github.com/flarum/framework.git
synced 2025-06-07 00:44:34 +08:00
Change name of avatar field in users table.
This commit is contained in:
@ -23,7 +23,7 @@ class CreateUsersTable extends Migration {
|
|||||||
$table->string('password');
|
$table->string('password');
|
||||||
$table->text('bio')->nullable();
|
$table->text('bio')->nullable();
|
||||||
$table->text('bio_html')->nullable();
|
$table->text('bio_html')->nullable();
|
||||||
$table->string('avatar')->nullable();
|
$table->string('avatar_path')->nullable();
|
||||||
$table->dateTime('join_time')->nullable();
|
$table->dateTime('join_time')->nullable();
|
||||||
$table->dateTime('last_seen_time')->nullable();
|
$table->dateTime('last_seen_time')->nullable();
|
||||||
$table->dateTime('read_time')->nullable();
|
$table->dateTime('read_time')->nullable();
|
||||||
|
@ -46,7 +46,7 @@ class UploadAvatarCommandHandler
|
|||||||
'target' => $this->uploadDir,
|
'target' => $this->uploadDir,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->changeAvatarUrl($uploadName);
|
$user->changeAvatarPath($uploadName);
|
||||||
|
|
||||||
event(new AvatarWillBeUploaded($user, $command));
|
event(new AvatarWillBeUploaded($user, $command));
|
||||||
|
|
||||||
|
@ -211,9 +211,15 @@ class User extends Model
|
|||||||
return $this;
|
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));
|
$this->raise(new UserAvatarWasChanged($this));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user