<?php

namespace App\Services;
use DB;

class ExamStuffService {

    /**
     * @param int $annee_acad
     * @return int
     */

    public static function get_total(int $annee_acad)
    {

        // get all ecs for some later requests
        $id_ecus = DB::connection('tenant')->table('ecu')
        ->where('annee_acad', '=', $annee_acad)
        ->pluck('idEC')
        ->toArray();

        $total = DB::connection('tenant')->table('examen')
        ->whereIn('idecu', $id_ecus)->count();

        return $total;
    }

}
