mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Add ContactPipeline
This commit is contained in:
parent
914681a4ad
commit
93b9035531
1 changed files with 44 additions and 0 deletions
44
app/Jobs/ContactPipeline/ContactPipeline.php
Normal file
44
app/Jobs/ContactPipeline/ContactPipeline.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs\ContactPipeline;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Contact;
|
||||
use App\Mail\ContactAdmin;
|
||||
use Mail;
|
||||
|
||||
class ContactPipeline implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $contact;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Contact $contact)
|
||||
{
|
||||
$this->contact = $contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$contact = $this->contact;
|
||||
if(config('instance.contact.enabled') == false || $this->read_at !== null) {
|
||||
return;
|
||||
}
|
||||
$email = config('instance.email');
|
||||
Mail::to($email)->send(new ContactAdmin($contact));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue