We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel is having trouble manipulate failed jobs
for example:
artisan queue:failedwill display all failed jobs but unfortunately, there is a field "failed_at".
artisan queue:failed
It has to be a string when displaying "failed_at" but it's a Date in fact.
Here is my immature implementation
<?php namespace My\ServiceProviders; use Illuminate\Database\ConnectionResolverInterface; use Illuminate\Queue\Failed\FailedJobProviderInterface; class MongoFailedJobProvider implements FailedJobProviderInterface { /** * The connection resolver implementation. * * @var \Illuminate\Database\ConnectionResolverInterface */ protected $resolver; /** * The database connection name. * * @var string */ protected $database; /** * The database table. * * @var string */ protected $table; /** * Create a new database failed job provider. * * @param \Illuminate\Database\ConnectionResolverInterface $resolver * @param string $database * @param string $table * @return void */ public function __construct(ConnectionResolverInterface $resolver, $database, $table) { $this->table = $table; $this->resolver = $resolver; $this->database = $database; } /** * Log a failed job into storage. * * @param string $connection * @param string $queue * @param string $payload * @return void */ public function log($connection, $queue, $payload) { $failed_at = date('Y-m-d H:i:s'); $this->getCollection()->insert(compact('connection', 'queue', 'payload', 'failed_at')); } /** * Get a list of all of the failed jobs. * * @return array */ public function all() { return $this->getCollection()->orderBy('failed_at', 'desc')->get(); } /** * Get a single failed job. * * @param mixed $id * @return array */ public function find($id) { return $this->getCollection()->where('_id', $id)->first(); } /** * Delete a single failed job from storage. * * @param mixed $id * @return bool */ public function forget($id) { return $this->getCollection()->where('_id', $id)->delete() > 0; } /** * Flush all of the failed jobs from storage. * * @return void */ public function flush() { $this->getCollection()->delete(); } /** * Get a new query builder instance for the table. * * @return \Illuminate\Database\Query\Builder */ protected function getCollection() { return $this->resolver->connection($this->database)->collection($this->table); } }
The text was updated successfully, but these errors were encountered:
I'm facing this problem.
It sends the failed jobs to mongodb, however artisan fails:
$ php artisan queue:failed [ErrorException] strstr() expects parameter 1 to be string, array given
How do I implement the workaround?
Is this going to be fixed?
Thank you,
Robson
Sorry, something went wrong.
No branches or pull requests
Laravel is having trouble manipulate failed jobs
for example:
artisan queue:failed
will display all failed jobs but unfortunately, there is a field "failed_at".It has to be a string when displaying "failed_at" but it's a Date in fact.
Here is my immature implementation
The text was updated successfully, but these errors were encountered: