<?php
/*
 * Dashboard - Get state of all courses
 */
function cass_dashboard_course_state_endpoint(){
    register_rest_route('wp-cass/v1', '/cass-dashboard-course-state', array(
        'methods' => 'GET',
        'callback' => 'get_cass_dashboard_course_state',
    ));

}

add_action('rest_api_init', 'cass_dashboard_course_state_endpoint');

function get_cass_dashboard_course_state($request) {
    return Dashboard::selectAllStateCourse();
}