Assign user input to data property on EditDiscussionCommand

This commit is contained in:
Toby Zerner 2015-05-02 09:01:27 +09:30
parent 0582d8e60f
commit 963273575f
2 changed files with 5 additions and 4 deletions

View File

@ -6,11 +6,12 @@ class EditDiscussionCommand
public $user;
public $title;
public $data;
public function __construct($discussionId, $user)
public function __construct($discussionId, $user, $data)
{
$this->discussionId = $discussionId;
$this->user = $user;
$this->data = $data;
}
}

View File

@ -22,8 +22,8 @@ class EditDiscussionCommandHandler
$discussion->assertCan($user, 'edit');
if (isset($command->title)) {
$discussion->rename($command->title, $user);
if (isset($command->data['title'])) {
$discussion->rename($command->data['title'], $user);
}
event(new DiscussionWillBeSaved($discussion, $command));