2017-10-30 3 views
2

this SDK을 사용하려는 두 개의 프로젝트가 있습니다. 하나는 Laravel 5.4이고 다른 하나는 Laravel 5.5입니다. Laravel 5.4 보내는 메시지와 함께 이 원활하게 진행하지만, Laravel 5.5 나는 다음과 같은 오류 있어요 : enter image description hereLaravel : 전보 SDK가 Laravel 5.5와 작동하지 않습니다.

코드는 다음과 같습니다

use App\Http\Controllers\TelegramController; 
. 
. 
. 
TelegramController::sendNotification('contactMail', $params); 

TelegramController :

<?php 

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 
use Illuminate\Support\Facades\Validator; 
use Telegram\Bot\Laravel\Facades\Telegram; 

class TelegramController extends Controller { 

    public function getHome() 
    { 
     return view('/'); 
    } 

    public function getUpdates() 
    { 
     $updates = Telegram::getUpdates(); 
     dd($updates); 
    } 

    public static function sendNotification($type, $params){ 
     switch($params['subject']){ 
      case 'contact': 
       $subject = 'Contact'; 
       break; 

      case 'pricequote': 
       $subject = 'PriceQuote'; 
      break; 
     } 
     switch($type){ 
      case 'contactMail': 
       $message = 'New message from:: ' . $params['email'] . ". Subject: " . $subject; 
     } 
     Telegram::sendMessage([ 
      'chat_id' => 'mychatId', 
      'text' => $message, 
     ]); 
    } 
} 

문제가 무엇인가를 ?

편집 : 나는/app.php config (설정) 할 줄을 추가하는 것을 잊었다

는을 찾을 수없는 것을,

가 지금은 다른 오류가 (씨 피라미드 감사합니다) TelegramOtherException. 나는 그것을 다시 설치하지만, 아직도 내가 오류 가지고 :

enter image description here

+0

어떻게 SDD를 설치 했습니까? – Yes92

+0

''irazasyed/telegram-bot-sdk ':''2. *''을'composer.json'에'composer.json'에 넣었습니다. – Feralheart

+0

내 대답을 확인하고 의사의 지시를 따르십시오. –

답변

2

당신이 언급 한 문서를 확인, 그것은 composer

{ 
    "require": { 
     "irazasyed/telegram-bot-sdk": "^2.0" 
    } 
} 

또는 대안

composer require irazasyed/telegram-bot-sdk ^2.0 
를 통해 SDK를 설치하는 두 가지 방법을 제안합니다

그런 다음 나중에 추가 providersapp/config.php

'Telegram' => Telegram\Bot\Laravel\Facades\Telegram::class 

에서 다음과 같은 방법

php artisan vendor:publish --provider="Telegram\Bot\Laravel\TelegramServiceProvider" 

또는

php artisan vendor:publish 

REF 중 하나에 의해 게시 마지막에 선택 사항입니다

Telegram\Bot\Laravel\TelegramServiceProvider::class 

다음 Facade : Telegram SDK Bot

참고 : Laravel 5.5에서는 facades가 자동으로 감지되지만 여전히 교차 확인을 권장합니다.

+0

고맙습니다. app.php의 행 이제 또 다른 예외가 있습니다. 나는 그 그림으로 질문을 편집했습니다. – Feralheart

+0

이 'composer dump-autoload'를 시도한 다음 'composer update'을 시도해 보셨습니까? –

관련 문제