=', $from]; if ($to) $where[] = ["created_at", '<=', $to]; $queries = DB::table('values')->where($where)->get(); return response()->json($queries); } }