<?php
/**
 * @link      http://www.u-bo.com
 * @copyright 南京友博网络科技有限公司 
 * @license   http://www.u-bo.com/license/
 */

namespace home\widgets\portlet;

use yii\helpers\Html;
use home\models\MessageLink;
use yii\base\InvalidConfigException;

/**
 * 消息通知组件
 * 
 * 调用方法如下：
 *
 * ```php
 * <?= MessagePortlet::widget([
 *     'title' => '测试组件',
 *     'x' => 0,
 *     'y' => 0,
 * ]) ?>
 * ```
 * 
 * @author legendjw http://blog.u-bo.com
 * @since 0.1
 */
class MessagePortlet extends BasePortlet 
{
	/**
     * @inheritdoc
     */
    public function getContent()
    {
        $messages = MessageLink::gainMessage(\Yii::$app->user->id);

        return $this->render('message', [
            'messages' => $messages
        ]);
    }
}
