title: CakePHP: Where To Place This Function
body: <p>I have 3 models: Student, Course and StudentCourse. Course 'hasAndBelongsToMany' Student, Student 'hasMany' Course, and StudentCourse 'belongsTo' Student and Course. Before a student can signup for a course, I need to check a few things (ie: is the course full, has that student taken that course in the past, etc). I can handle the logic inside of the function, but which model should I place that function under? And, how should it be called? One way I thought of was:</p>
  
  <pre><code>// Student Model
  public function canSignupForCourse($studentId, $courseId) {
      // is the course full?
      // have they signed up before, etc
      // return either true or false
  }
  
  // Could it then be called anywhere as:
  if($this-&gt;Student-&gt;canSignupForCourse($studentId, $courseId)) {
      // etc
  }
  </code></pre>
  
  <p>Or, is there a better/easier way to do it (and, do I need to send both the studentid and courseid each time)?</p>