refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
31
app/Jobs/Avatars/UpdateAllGravatars.php
Normal file
31
app/Jobs/Avatars/UpdateAllGravatars.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Avatars;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Models\Contact\Contact;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class UpdateAllGravatars implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable;
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$contacts = Contact::where('avatar_source', 'gravatar')
|
||||
->orWhere('avatar_gravatar_url', '<>', '')
|
||||
->active()
|
||||
->get();
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
UpdateGravatar::dispatch($contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user