File "Notification.php"

Full path: /home/qooetu/costes.qooetu.com/app/Widgets/Notification.php
File size: 820 B (820 B bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

<?php

namespace App\Widgets;

use Arrilot\Widgets\AbstractWidget;
use App\Messaging;
use Auth;

class Notification extends AbstractWidget
{
    /**
     * The configuration array.
     *
     * @var array
     */
    protected $config = [];

    /**
     * Treat this method as a controller action.
     * Return view() or other content to display.
     */
    public function run()
    {
        //

    $models=Messaging::where(['receiver_id'=>Auth::User()->id,'status'=>'Unread'])->take(5)->orderBy('created_at','DESC')->get();
   $counts=Messaging::where(['receiver_id'=>Auth::User()->id,'status'=>'Unread'])->count();

    return view("widgets.notification", [
            'config' => $this->config,
            'count'=>$counts,
            'models'=>$models,
        ]);
    }
}