помогите пожалуйста с решением вопроса
На сайте установлено Bitmessage оповещения. Пользователю приходит уведомление о новом сообщении, новой продаже и так далее
Если пользователь не установил у себя в настройках аккаунта Bitmessage адрес, то при написании ему в личку через интерфейс сайта,
выбивает ошибку
BitmessageNotify.php
<?php
namespace App\Jobs;
use App\Marketplace\Bitmessage\Bitmessage;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class BitmessageNotify implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 2;
/**
* Content to send via bitmessage
*
* @var string
*/
private $content;
/**
* Message title
*
* @var string
*/
private $title;
/**
* Bitmessage address to send content to
*
* @var string
*/
private $address;
/**
* Marketplace address
*
* @var \Illuminate\Config\Repository|mixed
*/
private $sender;
private $bitmessage;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(string $title,string $content,string $address)
{
$this->content = $content;
$this->address = $address;
$this->title = $title;
$this->sender = config('bitmessage.marketplace_address');
$this->bitmessage = new Bitmessage(
config('bitmessage.connection.username'),
config('bitmessage.connection.password'),
config('bitmessage.connection.host'),
config('bitmessage.connection.port')
);
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if ($this->attempts() <= $this->tries){
$this->bitmessage->sendMessage($this->address,$this->sender,$this->title,$this->content);
} else {
$this->delete();
}
}
}
Dispatchable.php
<?php
namespace Illuminate\Foundation\Bus;
use Illuminate\Contracts\Bus\Dispatcher;
trait Dispatchable
{
/**
* Dispatch the job with the given arguments.
*
* @return \Illuminate\Foundation\Bus\PendingDispatch
*/
public static function dispatch()
{
return new PendingDispatch(new static(...func_get_args()));
}
/**
* Dispatch a command to its appropriate handler in the current process.
*
* @return mixed
*/
public static function dispatchNow()
{
return app(Dispatcher::class)->dispatchNow(new static(...func_get_args()));
}
/**
* Set the jobs that should run if this job is successful.
*
* @param array $chain
* @return \Illuminate\Foundation\Bus\PendingChain
*/
public static function withChain($chain)
{
return new PendingChain(static::class, $chain);
}
}
PendingDispatch
<?php
namespace Illuminate\Foundation\Bus;
use Illuminate\Contracts\Bus\Dispatcher;
class PendingDispatch
{
/**
* The job.
*
* @var mixed
*/
protected $job;
/**
* Create a new pending job dispatch.
*
* @param mixed $job
* @return void
*/
public function __construct($job)
{
$this->job = $job;
}
/**
* Set the desired connection for the job.
*
* @param string|null $connection
* @return $this
*/
public function onConnection($connection)
{
$this->job->onConnection($connection);
return $this;
}
/**
* Set the desired queue for the job.
*
* @param string|null $queue
* @return $this
*/
public function onQueue($queue)
{
$this->job->onQueue($queue);
return $this;
}
/**
* Set the desired connection for the chain.
*
* @param string|null $connection
* @return $this
*/
public function allOnConnection($connection)
{
$this->job->allOnConnection($connection);
return $this;
}
/**
* Set the desired queue for the chain.
*
* @param string|null $queue
* @return $this
*/
public function allOnQueue($queue)
{
$this->job->allOnQueue($queue);
return $this;
}
/**
* Set the desired delay for the job.
*
* @param \DateTime|int|null $delay
* @return $this
*/
public function delay($delay)
{
$this->job->delay($delay);
return $this;
}
/**
* Set the jobs that should run if this job is successful.
*
* @param array $chain
* @return $this
*/
public function chain($chain)
{
$this->job->chain($chain);
return $this;
}
/**
* Handle the object's destruction.
*
* @return void
*/
public function __destruct()
{
app(Dispatcher::class)->dispatch($this->job);
}
}
Подскажите пожалуйста, как решить данную проблему, что необходимо прописать в коде, чтобы если пользователь, вдруг у себя в настройках не установит Bitmessage адрес, на скрине ниже пользователь как раз не установил себе Bitmessage адрес
Данная ошибка при написании ему в ЛС не выходила,
а просто доставляла сообщение пользователю, игнорируя то что он не указал Bitmessage адрес,(возможно вообше не знает что это такое или не хочет им пользоваться)
P.S если пользователь установил себе Bitmessage адрес в настройках то ошибка при написании ему в личку не появляеться.
Кофе для программистов: как напиток влияет на продуктивность кодеров?
Рекламные вывески: как привлечь внимание и увеличить продажи
Стратегії та тренди в SMM - Технології, що формують майбутнє сьогодні
Выделенный сервер, что это, для чего нужен и какие характеристики важны?
Современные решения для бизнеса: как облачные и виртуальные технологии меняют рынок
Подскажите, как ограничить количество строк таблицы, выводимых циклом foreach из БД sqlite на страницу? Нужно выводить не более 500 строка в БД их 10 тысяч
Делаю поиск на сайт, и мне нужно по тексту найти id родителя, как это можно сделать?
имеется такая проблема, что у меня не переносит код на следстроку в PHP