]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Controller.php
New strings
[bookstack] / app / Http / Controllers / Controller.php
index c5255c0ba53715436d09cf82c16b963ca201e8ad..a51ff5d77f9cc305575677f8557fc52056dfd862 100644 (file)
@@ -4,7 +4,7 @@ namespace BookStack\Http\Controllers;
 
 use BookStack\Ownable;
 use Illuminate\Foundation\Bus\DispatchesJobs;
-use Illuminate\Http\Exception\HttpResponseException;
+use Illuminate\Http\Exceptions\HttpResponseException;
 use Illuminate\Http\Request;
 use Illuminate\Routing\Controller as BaseController;
 use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -51,7 +51,9 @@ abstract class Controller extends BaseController
      */
     protected function preventAccessForDemoUsers()
     {
-        if (config('app.env') === 'demo') $this->showPermissionError();
+        if (config('app.env') === 'demo') {
+            $this->showPermissionError();
+        }
     }
 
     /**
@@ -100,7 +102,9 @@ abstract class Controller extends BaseController
      */
     protected function checkOwnablePermission($permission, Ownable $ownable)
     {
-        if (userCan($permission, $ownable)) return true;
+        if (userCan($permission, $ownable)) {
+            return true;
+        }
         return $this->showPermissionError();
     }
 
@@ -113,21 +117,12 @@ abstract class Controller extends BaseController
     protected function checkPermissionOr($permissionName, $callback)
     {
         $callbackResult = $callback();
-        if ($callbackResult === false) $this->checkPermission($permissionName);
+        if ($callbackResult === false) {
+            $this->checkPermission($permissionName);
+        }
         return true;
     }
 
-    /**
-     * Send a json respons with a message attached as a header.
-     * @param $data
-     * @param string $successMessage
-     * @return $this
-     */
-    protected function jsonSuccess($data, $successMessage = "")
-    {
-        return response()->json($data)->header('message-success', $successMessage);
-    }
-
     /**
      * Send back a json error message.
      * @param string $messageText
@@ -156,5 +151,4 @@ abstract class Controller extends BaseController
             ->withInput($request->input())
             ->withErrors($errors, $this->errorBag());
     }
-
 }