93 lines
2.5 KiB
PHP
93 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Notifikasi;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class NotifikasiController extends Controller
|
|
{
|
|
public function __construct(){
|
|
parent::__construct();
|
|
$this->setTitle("Notifikasi");
|
|
$this->setIconTitle("far fa-bell");
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return view('notifikasi.index');
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
}
|
|
|
|
public function edit(BelanjaRealisasi $realisasi_belanja)
|
|
{
|
|
}
|
|
|
|
public function update(Request $request, BelanjaRealisasi $realisasi_belanja)
|
|
{
|
|
}
|
|
|
|
public function datatable(Request $request)
|
|
{
|
|
$post = $request->all();
|
|
$offset = $post["start"];
|
|
$limit = $post["length"];
|
|
//$src = $post["src"];
|
|
|
|
$dataFilter=0;
|
|
$data = Notifikasi::where("userid",Auth::user()->id)->orderBy("created_at","DESC");
|
|
// if (!empty($src)){
|
|
// $data->whereRaw("(LOWER(message) LIKE '%".strtolower($src)."%')");
|
|
// }
|
|
$dataFilter = $data->count();
|
|
$dataTotal = Notifikasi::where("userid",Auth::user()->id)->count();
|
|
|
|
return response()->json([
|
|
"recordsTotal" => $dataTotal,
|
|
"recordsFiltered" => $dataFilter,
|
|
"data"=> $data->skip($offset)->take($limit)->get()
|
|
]);
|
|
}
|
|
|
|
public function destroy(BelanjaRealisasi $realisasi_belanja)
|
|
{
|
|
// try{
|
|
// DB::beginTransaction();
|
|
// $realisasi_belanja->delete();
|
|
// DB::commit();
|
|
// return redirect()->route('realisasi-pendapatan.index')
|
|
// ->with('success','Data Realisasi Pendapatan berhasil dihapus!');
|
|
|
|
// }catch(Throwable $e){
|
|
|
|
// DB::rollBack();
|
|
// return redirect()->route('realisasi-pendapatan.index')
|
|
// ->with('error','Data Realisasi Pendapatan gagal dihapus.');
|
|
// }
|
|
}
|
|
|
|
public function show(BelanjaRealisasi $realisasi_belanja)
|
|
{
|
|
// if (!Auth::user()->can("Lihat SKPP")){
|
|
// abort(403, 'Youre not allowed to visit this page!');
|
|
// }
|
|
// $this->setSubtitle("Detail Data");
|
|
// return view('realisasi_belanja.show',compact("realisasi_belanja"));
|
|
}
|
|
|
|
public function getNotif(Request $request)
|
|
{
|
|
$notif = Notifikasi::where(["userid"=>Auth::user()->id,"is_read"=>0])->get();
|
|
return response()->json($notif);
|
|
}
|
|
}
|