public function getModel(): Model
    {
        $name = $this->getModelName();
        $model = $this->app->make($name);

        if (! $model instanceof Model) {
            throw new InvalidArgumentException("Model [{$name}] should be an instance of Eloquent.");
        }

        $database = $this->getConfig('database');

        if (! \is_null($database)) {
            $model->setConnection($database);
        }

        $model->useWritePdo();

        return $model;
    }