You can add a validation to check if the User is already registered on another course on that date:
public function register($student, $course)
{
$overlap = CourseRegister::where('student', $student->id)
->where('end', '>', $course->start)
->where('start', '<', $course->end)
->exists();
if ($overlap) {
// cannot register
}
CourseRegister::create([
'student'=>$student,
'course'=>$course
]);
return redirect()->back();
}
*** Using student and course as foreign key columns goes against the convention of having a _id suffix; you might find naming the relations awkward as a result...