VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/vapecompany/demo.vapecompany.com.bd/app/Http/Controllers/Backend/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/vapecompany/demo.vapecompany.com.bd/app/Http/Controllers/Backend/NotificationController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Notification;
use Carbon\Carbon;

class NotificationController extends Controller
{
	public function __construct()
    {
        $this->middleware('auth');
       
    }
    public function showto($id)
    {
        $notification= Notification::where('notification_id',$id)->first();
        $target_id=$notification->target_url;
        $type=$notification->type;
        $notification->r_status=1;
        $notification->save();
       // dd($notification);
        if($type == 1){
        	 return redirect()->route('view_requisition',$target_id);
    	}else{
    		 return redirect()->route('viewchalan',$target_id);
    	}
       
    }
    public function all_notification(Request $request)
    {
        //dd(Carbon::now('Asia/dhaka')->format('d-m-Y h:i:s a'));
        if($request->ajax()){
            
            if(auth()->user()->employee->user_type != 3) {      
                $allNotification= Notification::where('department_id',auth()->user()->employee->department_id)->orderBy('notefication_date', 'desc')->skip($request->start)
                ->take($request->limit)->get();
            }
            else{
                $allNotification=Notification::where('is_user',auth()->user()->user_id)->orderBy('notefication_date', 'desc')->skip($request->start)
                ->take($request->limit)->get();
            }

            $output="";

            foreach ($allNotification as $key => $notification) {
                if($notification->r_status == 0)
                    $output .='<a target="_blank" style="background: #d4e0e7;" href="'.url('notification/'.$notification->notification_id).'"class="message-item">';
                else
                     $output .='<a target="_blank" href="'.url('notification/'.$notification->notification_id).'"class="message-item">';

                

                 $output .='<span class="btn btn-danger btn-circle"> 
                                                    <i class="fas fa-dolly-flatbed"></i> 
                                                </span>
                                                <div class="mail-contnet">
                                                    <h5 class="message-title">'.$notification->message.'</h5>  
                                                    <span class="time">'.Carbon::parse($notification->notefication_date)->format('d-m-Y H:i a').'</span> 
                                                </div> 
                                            </a>'; 
            }
            return $output;


        }
        
            $allNotification= Notification::where('user_id',auth()->user()->user_id)->orderBy('notefication_date', 'desc')->skip(0)
            ->take(15)->get();
            $countnoti=Notification::where('user_id',auth()->user()->user_id)->where('r_status',0)->count();
        
        return view('all_notification',['allNotification' =>$allNotification,'countnoti'=>$countnoti]);
       
       
    }
}

VaKeR 2022