mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 08:13:39 +08:00
Assign user input to data property on EditDiscussionCommand
This commit is contained in:
parent
0582d8e60f
commit
963273575f
|
@ -6,11 +6,12 @@ class EditDiscussionCommand
|
||||||
|
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
public $title;
|
public $data;
|
||||||
|
|
||||||
public function __construct($discussionId, $user)
|
public function __construct($discussionId, $user, $data)
|
||||||
{
|
{
|
||||||
$this->discussionId = $discussionId;
|
$this->discussionId = $discussionId;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->data = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ class EditDiscussionCommandHandler
|
||||||
|
|
||||||
$discussion->assertCan($user, 'edit');
|
$discussion->assertCan($user, 'edit');
|
||||||
|
|
||||||
if (isset($command->title)) {
|
if (isset($command->data['title'])) {
|
||||||
$discussion->rename($command->title, $user);
|
$discussion->rename($command->data['title'], $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new DiscussionWillBeSaved($discussion, $command));
|
event(new DiscussionWillBeSaved($discussion, $command));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user