[英]Laravel 5.4 - Issue with Jobs after move model
I have this error on my console. 我的控制台上出现此错误。 I use Jobs from Laravel 5.4 and I have move the Feed Model in App\\Models\\Feed .
我使用Laravel 5.4中的Jobs,并将Feed模型移至App \\ Models \\ Feed中 。 Since two days, I have this error because Laravel doesn't find the Feed Model .
自从两天以来,我就遇到了这个错误,因为Laravel找不到Feed模型 。 I have restart my Jobs with php artisan queue:restart .
我已经用php artisan queue:restart重新启动了Jobs。
[2017-07-13 10:45:33] staging.ERROR: Symfony\\Component\\Debug\\Exception\\FatalThrowableError: Class 'App\\Feed' not found in /home/site_com/http/www/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php:45
[2017-07-13 10:45:33]登台。错误:Symfony \\ Component \\ Debug \\ Exception \\ FatalThrowableError:在/ home / site_com / http / www / vendor / laravel / framework /中找不到类“ App \\ Feed” src / Illuminate / Queue / SerializesAndRestoresModelIdentifiers.php:45
<?php
namespace App\Jobs;
use App\Models\Feed;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class FetchFeeds implements ShouldQueue {
protected $feed;
public function __construct(Feed $feed)
{
$this->feed = $feed;
}
}
My Feed model: 我的Feed模型:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\HybridRelations;
class Feed extends Model
{
use HybridRelations;
protected $connection = 'mysql';
protected $fillable = [
//
];
protected $dates = [
'created_at',
'updated_at'
];
...
}
我已经更改了工作名称,它可以工作。
php artisan queue:restart
relies on on the cache system to schedule the restart. php artisan queue:restart
依赖于缓存系统来计划重新启动。
If you are using APCu there is a chance that the cache it is not working with cli jobs. 如果您使用的是APCu,则它的缓存可能无法与cli作业一起使用。 In this case the recommendation is to add
apc.enable_cli=1
to your APCu configuration 在这种情况下,建议将
apc.enable_cli=1
添加到您的APCu配置中
In any case I will try to do a complete stop/start of the queue listener/worker. 无论如何,我都会尝试完全停止/启动队列侦听器/工作者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.