HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.30
System: Linux multiplicar 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64
User: root (0)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /var/www/html/xfacil.desafio.com.py/app/Http/Livewire/Adminnotificaciones.php
<?php

namespace App\Http\Livewire;

use Livewire\Component;
use Livewire\WithPagination;
use App\Models\Notificacion;
use DB;

class Adminnotificaciones extends Component{

    use WithPagination;

    protected $paginationTheme = 'bootstrap';

    public $leidos,$noleidos;

    public function render(){



        $notificaciones=Notificacion::select(
            DB::raw('DISTINCT(data)'))->paginate(20);

        return view('livewire.adminnotificaciones',["notificaciones"=>$notificaciones]);
    }

    public function estados($data){

        $this->leidos=DB::table('notifications as no')
            ->join('users as us','no.notifiable_id','us.id')
            ->select('no.*','us.name')
            ->where('data','LIKE','%'.$data.'%')->whereNotNull('read_at')->get();

        $this->noleidos=DB::table('notifications as no')
            ->join('users as us','no.notifiable_id','us.id')
            ->select('no.*','us.name')
            ->where('data','LIKE','%'.$data.'%')->whereNull('read_at')->get();
    }
}