public createComment ( $comment ) : Illuminate\Database\Eloquent\Model | ||
$comment | object item_id, user_id, body, username, email | |
return | Illuminate\Database\Eloquent\Model |
public function createComment($comment)
{
$object = array();
$object["item_id"] = $comment->item_id;
$object["user_id"] = $comment->user_id;
$object["body"] = $comment->body;
$comment_id = $this->insert($object);
$ret = $this->getCommentById($comment_id);
$user = app('stdClass');
$user->username = $comment->username;
$user->email = $comment->email;
$ret->user = $user;
return $ret;
}