Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app/Http
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2015-12-29 01:54:53 +0300
committerChaoyi Zha <summermontreal@gmail.com>2015-12-29 01:54:53 +0300
commit96f5b1e270b3b5461d7507db37e0ff085276a239 (patch)
treec4bb4b10989988d79d5f2e6b1e801dc4125d8a97 /app/Http
parentb662511aa91f5ee25cd57622dc366a8714a5d665 (diff)
Refactor error handlers in LinkController to use toasts
Diffstat (limited to 'app/Http')
-rw-r--r--app/Http/Controllers/LinkController.php8
-rw-r--r--app/Http/Controllers/UserController.php2
2 files changed, 4 insertions, 6 deletions
diff --git a/app/Http/Controllers/LinkController.php b/app/Http/Controllers/LinkController.php
index d38b7ee..161ef30 100644
--- a/app/Http/Controllers/LinkController.php
+++ b/app/Http/Controllers/LinkController.php
@@ -16,9 +16,7 @@ class LinkController extends Controller {
*/
private function renderError($message) {
- $this->request->session()->flash('error', $message);
-
- return redirect()->route('index');
+ return redirect(route('index'))->with('error', $message);
}
private function formatAndRender($link_ending, $secret_ending=False) {
@@ -40,7 +38,7 @@ class LinkController extends Controller {
$is_already_short = LinkHelper::checkIfAlreadyShortened($long_url);
if ($is_already_short) {
- return $this->renderError('Sorry, but your link already
+ return $this->renderError('Sorry, but your link already\
looks like a shortened URL.');
}
@@ -54,7 +52,7 @@ class LinkController extends Controller {
// has custom ending
$ending_conforms = LinkHelper::validateEnding($custom_ending);
if (!$ending_conforms) {
- return $this->renderError('Sorry, but custom endings
+ return $this->renderError('Sorry, but custom endings\
can only contain alphanumeric characters');
}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 2a1a747..45e0c35 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -47,7 +47,7 @@ class UserController extends Controller {
public function performSignup(Request $request) {
if (env('POLR_ALLOW_ACCT_CREATION') == false) {
- return redirect('index')->with('error', 'Sorry, but registration is disabled.');
+ return redirect(route('index'))->with('error', 'Sorry, but registration is disabled.');
}
$username = $request->input('username');