Files
UNIT3D-Community-Edition/app/Jobs/SendDeleteUserMail.php
T
2018-12-06 14:42:13 +00:00

65 lines
1.4 KiB
PHP

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
*
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/
namespace App\Jobs;
use App\Mail\DeleteUser;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
class SendDeleteUserMail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @var User
*/
public $user;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 3;
/**
* ActivateUser constructor.
*
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if ($this->attempts() > 2) {
$this->delay(min(30 * $this->attempts(), 300));
}
Mail::to($this->user)->send(new DeleteUser($this->user));
}
}