我想使用电报从聊天机器人创建pdf,我正在使用botman studio 集成了laravel。
BotMan是一个与框架无关的PHP库,旨在简化为多个消息传递平台(包括Slack,Telegram,Microsoft Bot Framework,Nexmo,HipChat,Facebook Messenger,WeChat等)开发创新型机器人的任务。
调查涉及到html的dompdf库相对容易使用,但是我想用bot的功能填充它,而不是返回视图而不是返回API。
private function searchCompatibility()
{
$detalles = DB::table('detalle_cable')->join('cable', 'cable.id', '=', 'detalle_cable.idcable')
->join('modelo', 'modelo.id', '=', 'detalle_cable.idmodelo')
->join('marca','marca.id','=','modelo.idmarca')
->where('modelo.description','=', $this->valueModel)
->where('marca.id','=', $this->valueBrand)
->select('cable.description as ca')
->groupBy('ca')
->get();
$detalles2 = DB::table('conector_detalle')
->join('conector', 'conector.id', '=', 'conector_detalle.idconec')
->join('modelo', 'modelo.id', '=', 'conector_detalle.idmodelo')
->join('marca','marca.id','=','modelo.idmarca')
->where('modelo.description','=', $this->valueModel)
->where('marca.id','=', $this->valueBrand)
->select('conector.descripcion as co')
->groupBy('co')
->get();
$detalles3 = DB::table('detalle_configuracion')
->join('configuracion', 'configuracion.id', '=', 'detalle_configuracion.idconf')
->join('modelo', 'modelo.id', '=', 'detalle_configuracion.idmodelo')
->join('marca','marca.id','=','modelo.idmarca')
->where('modelo.description','=', $this->valueModel)
->where('marca.id','=', $this->valueBrand)
->select('configuracion.descripcion as con')
->groupBy('con')
->get();
$this->say('Compatibilidad para '.$this->valueModel.':');
$this->say('Conector: ');
foreach ($detalles2 as $key => $detalle) {
$this->say(''.$detalle->co);
}
$this->say('Cable: ');
foreach ($detalles as $key => $deta) {
$this->say(''.$deta->ca);
}
$this->say('Configuracion: ');
foreach ($detalles3 as $key => $detal) {
$this->say(''.$detal->con);
}
$this->continuar();
}
例如,此代码片段可在App / Conversations.php中找到
如何将其传递给pdf?