Skip to content

Commit

Permalink
(Update) Refactor Toastr Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
HDVinnie committed Feb 16, 2018
1 parent 8a8f440 commit edbc681
Show file tree
Hide file tree
Showing 33 changed files with 148 additions and 154 deletions.
3 changes: 0 additions & 3 deletions app/Http/Controllers/AnnounceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
use App\PersonalFreeleech;
use App\FreeleechToken;
use App\Group;

use Carbon\Carbon;

use App\Services\Bencode;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Log;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ActivationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function activate($token)
$activation->delete();
return redirect()->route('login')->with(Toastr::success('Account Confirmed! You May Now Login!', 'Yay!', ['options']));
} else {
return redirect()->route('login')->with(Toastr::warning('Banned or Invalid Token Or Account Already Confirmed!', 'Whoops!', ['options']));
return redirect()->route('login')->with(Toastr::error('Banned or Invalid Token Or Account Already Confirmed!', 'Whoops!', ['options']));
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ForgotUsernameController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function sendUserameReminder(Request $request)
$user = User::where('email', $email)->first();

if (empty($user)) {
return redirect()->route('username.request')->with(Toastr::warning('We could not find this email in our system!', 'Error', ['options']));
return redirect()->route('username.request')->with(Toastr::error('We could not find this email in our system!', 'Whoops!', ['options']));
}

//send username reminder notification
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function authenticated(Request $request, $user)
if ($user->active == 0 || $user->group_id == 1) {
auth()->logout();
$request->session()->flush();
return redirect()->route('login')->with(Toastr::warning('This account has not been activated and is still in validating group, Please check your email for activation link. If you did not receive the activation code, please click "forgot password" and complete the steps.', 'Whoops!', ['options']));
return redirect()->route('login')->with(Toastr::error('This account has not been activated and is still in validating group, Please check your email for activation link. If you did not receive the activation code, please click "forgot password" and complete the steps.', 'Whoops!', ['options']));
}
if ($user->group_id == 5) {
auth()->logout();
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ public function register($code = null)
{
// Make sure open reg is off and ivite code exsists and is not used or expired
if (config('other.invite-only') == true && $code == null) {
return view('auth.login')->with(Toastr::warning('Open Reg Closed! You Must Be Invited To Register!', 'Error', ['options']));
return view('auth.login')->with(Toastr::error('Open Reg Closed! You Must Be Invited To Register!', 'Whoops!', ['options']));
}

if (Request::isMethod('post')) {
$key = Invite::where('code', '=', $code)->first();
if (config('other.invite-only') == true && !$key) {
return view('auth.register', ['code' => $code])->with(Toastr::warning('Invalid or Expired Invite Key!', 'Error', ['options']));
return view('auth.register', ['code' => $code])->with(Toastr::error('Invalid or Expired Invite Key!', 'Whoops!', ['options']));
}

$current = Carbon::now();
Expand All @@ -59,7 +59,7 @@ public function register($code = null)
$v = Validator::make($input, $user->rules);
if ($v->fails()) {
$errors = $v->messages();
return redirect()->route('register', ['code' => $code])->with(Toastr::warning('Either The Username/Email is already in use or you missed a field. Make sure password is also min 8 charaters!', 'Error', ['options']));
return redirect()->route('register', ['code' => $code])->with(Toastr::error('Either The Username/Email is already in use or you missed a field. Make sure password is also min 8 charaters!', 'Whoops!', ['options']));
} else {
// Create The User
$group = Group::where('slug', '=', 'validating')->first();
Expand Down Expand Up @@ -99,7 +99,7 @@ public function register($code = null)
// Activity Log
\LogActivity::addToLog("Member " . $user->username . " has successfully registered to site.");

return redirect()->route('login')->with(Toastr::info('Thanks for signing up! Please check your email to Validate your account', 'Yay!', ['options']));
return redirect()->route('login')->with(Toastr::success('Thanks for signing up! Please check your email to Validate your account', 'Yay!', ['options']));
}
}
return view('auth.register', ['code' => $code]);
Expand Down
20 changes: 10 additions & 10 deletions app/Http/Controllers/BonusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ public function exchange($id)
$flag = $this->doItemExchange($user->id, $id);

if (!$flag) {
return redirect('/bonus')->with(Toastr::info('Failed!', 'Bonus Exchange', ['options']));
return redirect('/bonus')->with(Toastr::error('Bonus Exchange Failed!', 'Whoops!', ['options']));
}

$user->seedbonus -= $itemCost;
$user->save();
} else {
return redirect('/bonus')->with(Toastr::info('Failed!', 'Bonus Exchange', ['options']));
return redirect('/bonus')->with(Toastr::error('Bonus Exchange Failed!', 'Whoops!', ['options']));
}

return redirect('/bonus')->with(Toastr::info('Successful', 'Bonus Exchange', ['options']));
return redirect('/bonus')->with(Toastr::success('Bonus Exchange Successful', 'Yay!', ['options']));
}

/**
Expand Down Expand Up @@ -200,7 +200,7 @@ public function gift()
$recipient = User::where('username', 'LIKE', Request::get('to_username'))->first();

if (!$recipient || $recipient->id == $user->id) {
return redirect('/bonus')->with(Toastr::error('Unable to find specified user', 'Gifting Failed', ['options']));
return redirect('/bonus')->with(Toastr::error('Unable to find specified user', 'Whoops!', ['options']));
}

$value = Request::get('bonus_points');
Expand Down Expand Up @@ -228,12 +228,12 @@ public function gift()

PrivateMessage::create(['sender_id' => $user->id, 'reciever_id' => $recipient->id, 'subject' => "You Have Recieved A Gift", 'message' => $transaction->comment]);

return redirect('/bonus')->with(Toastr::info('Sent', 'Gift', ['options']));
return redirect('/bonus')->with(Toastr::success('Gift Sent', 'Yay!', ['options']));
} else {
return redirect('/bonus')->with(Toastr::error('Failed', 'Gifting', ['options']));
return redirect('/bonus')->with(Toastr::error('Gifting Failed', 'Whoops!', ['options']));
}
} else {
return redirect('/bonus')->with(Toastr::error('Unknown error occurred', 'Error!', ['options']));
return redirect('/bonus')->with(Toastr::error('Unknown error occurred', 'Whoops!', ['options']));
}
}

Expand All @@ -252,13 +252,13 @@ public function tipUploader($slug, $id)

$tip_amount = Request::get('tip');
if ($tip_amount > $user->seedbonus) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('Your To Broke To Tip The Uploader!', 'Bro!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('Your To Broke To Tip The Uploader!', 'Whoops!', ['options']));
}
if ($user->id == $torrent->user_id) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('You Cannot Tip Yourself!', 'Bro!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('You Cannot Tip Yourself!', 'Whoops!', ['options']));
}
if ($tip_amount < 0) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('You Cannot Tip A Negative Amount!', 'Bro!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('You Cannot Tip A Negative Amount!', 'Whoops!', ['options']));
}
$uploader->seedbonus += $tip_amount;
$uploader->save();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BookmarkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public function bookmarks()
public function unBookmark($id)
{
Auth::user()->bookmarks()->detach($id);
return redirect()->route('bookmarks')->with(Toastr::info('Torrent Has Been Unbookmarked Successfully!', 'Info', ['options']));
return redirect()->route('bookmarks')->with(Toastr::success('Torrent Has Been Unbookmarked Successfully!', 'Yay!', ['options']));
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/BugController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function bug()

Mail::to($user->email, $user->username)->send(new Bug($input));

Toastr::success('Your Bug Was Succefully Sent!', 'Success', ['options']);
Toastr::success('Your Bug Was Succefully Sent!', 'Yay!', ['options']);
}
return view('bug.bug');
}
Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function article($slug, $id)

// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])->with(Toastr::warning('Your Comment Rights Have Benn Revoked!!!', 'Error!', ['options']));
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}

$comment = new Comment();
Expand All @@ -75,7 +75,7 @@ public function article($slug, $id)
$comment->save();
Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']);
} else {
Toastr::warning('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Whoops!', ['options']);
}
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id]);
}
Expand All @@ -93,7 +93,7 @@ public function torrent($slug, $id)

// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('Your Comment Rights Have Benn Revoked!!!', 'Error!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}

$comment = new Comment();
Expand Down Expand Up @@ -135,7 +135,7 @@ public function torrent($slug, $id)
Cache::forget('shoutbox_messages');
}
} else {
Toastr::warning('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
}
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id]);
}
Expand All @@ -153,7 +153,7 @@ public function request($id)

// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('request', ['id' => $request->id])->with(Toastr::warning('Your Comment Rights Have Benn Revoked!!!', 'Error!', ['options']));
return redirect()->route('request', ['id' => $request->id])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}

$comment = new Comment();
Expand Down Expand Up @@ -196,7 +196,7 @@ public function request($id)
Cache::forget('shoutbox_messages');
}
} else {
Toastr::warning('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
}
return redirect()->route('request', ['id' => $request->id]);
}
Expand All @@ -215,7 +215,7 @@ public function quickthanks($id)

// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::warning('Your Comment Rights Have Benn Revoked!!!', 'Error!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}

$comment = new Comment();
Expand Down Expand Up @@ -253,7 +253,7 @@ public function quickthanks($id)
Shoutbox::create(['user' => "1", 'mentions' => "1", 'message' => "User [url={$appurl}/" . $user->username . "." . $user->id . "]" . $user->username . "[/url] has left a comment on Torrent [url={$appurl}/torrents/" . $torrent->slug . "." . $torrent->id . "]" . $torrent->name . "[/url]"]);
Cache::forget('shoutbox_messages');
} else {
Toastr::warning('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']);
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Whoops!', ['options']);
}

return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id]);
Expand Down
10 changes: 5 additions & 5 deletions app/Http/Controllers/FollowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class FollowController extends Controller
public function follow(User $user)
{
if (Auth::user()->id == $user->id) {
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error("Nice try, but sadly you can not follow yourself.", 'Error!', ['options']));
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error("Nice try, but sadly you can not follow yourself.", 'Whoops!', ['options']));
} elseif (!Auth::user()->isFollowing($user->id)) {
// Create a new follow instance for the authenticated user
Auth::user()->follows()->create([
'target_id' => $user->id,
]);
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are now following ' . $user->username, 'Success!', ['options']));
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are now following ' . $user->username, 'Yay!', ['options']));
} else {
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are already following this user', 'Error!', ['options']));
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are already following this user', 'Whoops!', ['options']));
}
}

Expand All @@ -54,9 +54,9 @@ public function unfollow(User $user)
$follow = Auth::user()->follows()->where('target_id', $user->id)->first();
$follow->delete();

return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are no longer following ' . $user->username, 'Success!', ['options']));
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are no longer following ' . $user->username, 'Yay!', ['options']));
} else {
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are not following this user to begin with', 'Error!', ['options']));
return redirect()->route('profil', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are not following this user to begin with', 'Whoops!', ['options']));
}
}
}
Loading

0 comments on commit edbc681

Please sign in to comment.