Hi! For the first problem you're facing you can use a hasManyThrough on the Country model:
//country.php
public function students(){
return $this->hasManyThrough('App\Agency','App\Student');
}
//count students by country:
$studentsCount = $country->students()->count();
//get students for country
$students = $country->students;