/** * Get the github api client for a model. * * @param \Illuminate\Database\Eloquent\Model $model * @param array $options * * @throws \InvalidArgumentException * * @return \Github\Client */ public function make(Model $model, $options = []) { switch (get_class($model)) { case User::class: $token = $model->token; break; case Repo::class: $token = $model->user->token; break; default: throw new InvalidArgumentException('You must provide a user or repo.'); } return $this->factory->make(array_merge(['token' => $token, 'method' => 'token'], $options)); }
/** * Create the connection instance. * * @param array $config * * @return \Github\Client */ protected function createConnection(array $config) { return $this->factory->make($config); }