I have two project where I want to use this SDK. One is Laravel 5.4 the second is Laravel 5.5. With Laravel 5.4 the message sending goes smoothly, but with the Laravel 5.5 I got the following error:
The code is:
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,
]);
}
}
What's the problem?
Edit:
I forgot to add the lines to config/app.php (thank you, Mr. Pyramid)
Now I have an another error, that it don't find the TelegramOtherException
. I reinstalled it, but still I got the error: