public function associate($model) { if (!class_exists($model)) { throw new Exception("Invalid model name '{$model}'."); } $this->model = $model; return $this; }