update: auto pre warnings

This commit is contained in:
HDVinnie
2022-01-10 06:11:25 -05:00
parent cde0688eac
commit 38e4f6eea0
2 changed files with 6 additions and 10 deletions
+3 -9
View File
@@ -16,6 +16,7 @@ namespace App\Console\Commands;
use App\Models\History;
use App\Models\PrivateMessage;
use App\Models\Warning;
use App\Notifications\UserPreWarning;
use Carbon\Carbon;
use Illuminate\Console\Command;
@@ -75,15 +76,8 @@ class AutoPreWarning extends Command
if ($exsist === null) {
$timeleft = \config('hitrun.grace') - \config('hitrun.prewarn');
// Send Private Message
$pm = new PrivateMessage();
$pm->sender_id = 1;
$pm->receiver_id = $pre->user->id;
$pm->subject = 'Hit and Run Warning Incoming';
$pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.\config('hitrun.prewarn').\sprintf(' days on Torrent %s
and have not yet met the required seedtime rules set by ', $pre->torrent->name).\config('other.title').\sprintf('. If you fail to seed it within %s day(s) you will receive a automated WARNING which will last ', $timeleft).\config('hitrun.expire').' days![/b]
[color=red][b] THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
$pm->save();
// Send Notifications
$pre->user->notify(new UserPreWarning($pre->user, $pre->torrent));
// Set History Prewarn
$pre->prewarn = 1;
+3 -1
View File
@@ -2,6 +2,8 @@
namespace App\Notifications;
use App\Models\Torrent;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -14,7 +16,7 @@ class UserPreWarning extends Notification
/**
* Create a new notification instance.
*/
public function __construct()
public function __construct(public User $user, public Torrent $torrent)
{
}