Skip to content

Commit

Permalink
Merge pull request #486 from singularity43/sandbox
Browse files Browse the repository at this point in the history
(Fix) Ban System
  • Loading branch information
HDVinnie authored Jan 11, 2019
2 parents 9855680 + 2826d69 commit c1f9543
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/AutoBan.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function handle()
$logban->save();

// Send Email
Mail::to($ban->warneduser->email)->send(new BanUser($logban));
Mail::to($ban->warneduser->email)->send(new BanUser($ban->warneduser->email, $logban));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Staff/BanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function ban(Request $request, $username, $id)
\LogActivity::addToLog("Staff Member {$staff->username} has banned member {$user->username}.");

// Send Email
Mail::to($user->email)->send(new BanUser($user, $ban));
Mail::to($user->email)->send(new BanUser($user->email, $ban));

return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with($this->toastr->success('User Is Now Banned!', 'Yay!', ['options']));
Expand Down Expand Up @@ -156,7 +156,7 @@ public function unban(Request $request, $username, $id)
\LogActivity::addToLog("Staff Member {$staff->username} has unbanned member {$user->username}.");

// Send Email
Mail::to($user->email)->send(new UnbanUser($user, $ban));
Mail::to($user->email)->send(new UnbanUser($user->email, $ban));

return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with($this->toastr->success('User Is Now Relieved Of His Ban!', 'Yay!', ['options']));
Expand Down
8 changes: 5 additions & 3 deletions app/Mail/BanUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ class BanUser extends Mailable
{
use Queueable, SerializesModels;

public $logban;
public $email;
public $ban;

/**
* Create a new message instance.
*
* @return void
*/
public function __construct($logban)
public function __construct($email, $ban)
{
$this->logban = $logban;
$this->email = $email;
$this->ban = $ban;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Mail/UnbanUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ class UnbanUser extends Mailable
use Queueable, SerializesModels;

public $email;
public $ban;

/**
* Create a new message instance.
*
* @return void
*/
public function __construct($email)
public function __construct($email, $ban)
{
$this->email = $email;
$this->ban = $ban;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion resources/views/emails/ban.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@component('mail::message')
# @lang('email.banned-header')!

**Reason:** {{ $logban->ban_reason }}
**Reason:** {{ $ban->ban_reason }}

*@lang('email.banned-footer')*
@endcomponent

0 comments on commit c1f9543

Please sign in to comment.