app/Http/Controllers/Api/PresensiController.php
/**
     * Get List Presences by User
     * @param Request $request
     * @return JsonResponse
     * @throws BindingResolutionException
     */
Get List Presences by User
@param Request $request
@return JsonResponse
@throws BindingResolutionException
Get List Presences by User @param Request $request @return JsonResponse @throws BindingResolutionException
public function riwayat(Request $request)
    {
        $request->validate(
            [
                'from' => ['required'],
                'to' => ['required'],
            ]
        );
        $riwayat = $request->user()->presensis()->with('detail')
            ->whereBetween(
                DB::raw('DATE(created_at)'),
                [
                    $request->from, $request->to
                ]
            )->get();
        return response()->json(
            [
                'message' => "list of presences by user",
                'data' => $riwayat,
            ],
            Response::HTTP_OK
        );
    }
public function riwayat ( Request $ request ) { $ request -> validate ( [ 'from' => [ 'required' ] , 'to' => [ 'required' ] , ] ) ; $ riwayat = $ request -> user ( ) -> presensis ( ) -> with ( 'detail' ) -> whereBetween ( DB :: raw ( 'DATE(created_at)' ) , [ $ request -> from , $ request -> to ] ) -> get ( ) ; return response ( ) -> json ( [ 'message' => " list of presences by user " , 'data' => $ riwayat , ] , Response :: HTTP_OK ) ; }
Get List Presences by User
 @param Request $request
 @return JsonResponse
 @throws BindingResolutionException
Get List Presences by User @param Request $request @return JsonResponse @throws BindingResolutionException