我需要在失败后 7 分钟后重试作业。我尝试使用$this->release(7);但有时工作运行的次数超过 1 次。
<?php
namespace Froakie\Listeners;
use Froakie\Components\Locks\LocksFactory;
use Froakie\Components\CRM\CrmFactory;
use Froakie\Events\NewLeadDataIncoming;
use Froakie\Services\LeadsService;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
/**
* Class CreateLead
*
* @package Froakie\Listeners
* @author Miguel Borges <miguel.borges@edirectinsure.com>
*/
class CreateOrUpdateLead implements ShouldQueue
{
use InteractsWithQueue;
const LOCKS_PREFIX = 'lead_event_lock_';
/**
* @var \Froakie\Services\LeadsService
*/
protected $leadsService;
/**
* Create the event listener.
*
* @param \Froakie\Services\LeadsService $leadsService
*/
public function __construct(LeadsService $leadsService)
{
$this->leadsService = $leadsService;
}
/**
* Handle the event. …Run Code Online (Sandbox Code Playgroud) 我尝试在laravel 4中扩展一个facede,但是在尝试调用方法时我只会遇到下一个错误.
Non-static method App\Libraries\Theme::setActive() should not be called statically
Run Code Online (Sandbox Code Playgroud)
在响应@Antonio之后,要将方法更改为static,请在方法中使用关键字$ this->.
Symfony\Component\Debug\Exception\FatalErrorException当不在对象上下文中时使用$ this $active = $this->ensureRegistered($active);
我的代码:
<?php namespace App\Libraries;
use Cartalyst\Themes\Facades\Theme as ThemeBag;
class Theme extends ThemeBag {
/**
* Sets the active theme.
*
* @param mixed $active
* @return Cartalyst\Themes\ThemeInterface
*/
public static function setActive($active)
{
$active = $this->ensureRegistered($active);
if ( ! isset($this->themes[$active->getSlug()]))
{
$this->register($active);
}
$this->active = $active;
include $this->getActive()->getPath() . '\\helpers\\composers.php';
}
}
Run Code Online (Sandbox Code Playgroud) 我需要一个库来在我的页面中生成一些图表。我找到了phpChart,但我不知道如何安装它。
我的问题是:如何通过 composer 在 Laravel 中安装 phpChart。
我需要在侦听器上的特定失败作业之间设置延迟。我知道如果指定选项它的工作原理,但我需要监听器--delay=5上的特定延迟(而不是标准作业)。我尝试将该属性放在侦听器上,但不起作用。delay
<?php
namespace Froakie\Listeners;
use Carbon\Carbon;
use Froakie\Events\ExampleEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
/**
* Class ExampleListener
*
* @package Froakie\Listeners
* @author Miguel Borges <miguel.borges@edirectinsure.com>
*/
class ExampleListener implements ShouldQueue
{
use InteractsWithQueue;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 5;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = …Run Code Online (Sandbox Code Playgroud) 我有一个上传文件的函数wp_handle_upload().
$file = $_FILES['attachment_icon-' . $i];
$upload = wp_handle_upload($file, array('test_form' => false));
Run Code Online (Sandbox Code Playgroud)
什么是删除上传文件的功能?
laravel ×4
laravel-4 ×2
laravel-5 ×2
charts ×1
composer-php ×1
file-upload ×1
laravel-5.5 ×1
laravel-jobs ×1
php ×1
wordpress ×1