mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-04 17:30:27 -05:00
(Update) Refator Toastr Notifications
This commit is contained in:
@@ -18,7 +18,7 @@ use App\Http\Requests\VoteOnPoll;
|
||||
use App\Poll;
|
||||
use App\Option;
|
||||
use App\Voter;
|
||||
use \Toastr;
|
||||
use Brian2694\Toastr\Toastr;
|
||||
|
||||
class PollController extends Controller
|
||||
{
|
||||
@@ -27,9 +27,21 @@ class PollController extends Controller
|
||||
*/
|
||||
private $chat;
|
||||
|
||||
public function __construct(ChatRepository $chat)
|
||||
/**
|
||||
* @var Toastr
|
||||
*/
|
||||
private $toastr;
|
||||
|
||||
/**
|
||||
* PollController Constructor
|
||||
*
|
||||
* @param ChatRepository $chat
|
||||
* @param Toastr $toastr
|
||||
*/
|
||||
public function __construct(ChatRepository $chat, Toastr $toastr)
|
||||
{
|
||||
$this->chat = $chat;
|
||||
$this->toastr = $toastr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +70,7 @@ class PollController extends Controller
|
||||
|
||||
if ($user_has_voted) {
|
||||
return redirect('poll/' . $poll->slug . '/result')
|
||||
->with(Toastr::info('You have already vote on this poll. Here are the results.', 'Hey There!', ['options']));
|
||||
->with($this->toastr->info('You have already vote on this poll. Here are the results.', 'Hey There!', ['options']));
|
||||
}
|
||||
|
||||
return view('poll.show', compact('poll'));
|
||||
@@ -81,7 +93,7 @@ class PollController extends Controller
|
||||
|
||||
if (Voter::where('user_id', $user->id)->where('poll_id', $poll->id)->exists()) {
|
||||
return redirect('poll/' . $poll->slug . '/result')
|
||||
->with(Toastr::error('Bro have already vote on this poll. Your vote has not been counted.', 'Whoops!', ['options']));
|
||||
->with($this->toastr->error('Bro have already vote on this poll. Your vote has not been counted.', 'Whoops!', ['options']));
|
||||
}
|
||||
|
||||
if ($poll->ip_checking == 1) {
|
||||
@@ -100,7 +112,7 @@ class PollController extends Controller
|
||||
);
|
||||
|
||||
return redirect('poll/' . $poll->slug . '/result')
|
||||
->with(Toastr::success('Your vote has been counted.', 'Yay!', ['options']));
|
||||
->with($this->toastr->success('Your vote has been counted.', 'Yay!', ['options']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user