diff --git a/app/Models/Kasbonview.php b/app/Models/Kasbonview.php index 2159e78..388e91e 100644 --- a/app/Models/Kasbonview.php +++ b/app/Models/Kasbonview.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -63,5 +64,22 @@ public static function jumlahKasbonKaryawan(){ ]; } + public function index() + { + return view('admin.laporan'); + } + + public function getKasbonData(Request $request) + { + $month = $request->input('month'); + $year = $request->input('year'); + + $kasbonData = Kasbonview::whereMonth('updated_at', $month) + ->whereYear('updated_at', $year) + ->get(); + + return response()->json($kasbonData); // Ensure this returns JSON + } + }