(Update) Refator Toastr Notifications

This commit is contained in:
HDVinnie
2018-11-12 11:14:41 -05:00
parent 587eb9f03e
commit 87563a2473
46 changed files with 954 additions and 359 deletions
+17 -5
View File
@@ -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']));
}
/**