Completed
Push — master ( 88e368...e2f64d )
by Maxime
02:26
created
src/Distilleries/Expendable/Models/BaseModel.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -520,16 +520,16 @@  discard block
 block discarded – undo
520 520
     public function scopeSearch($query, $searchQuery)
521 521
     {
522 522
 
523
-        return $query->where(function ($query) use ($searchQuery) {
523
+        return $query->where(function($query) use ($searchQuery) {
524 524
             $columns = $this->getAllColumnsNames();
525 525
 
526 526
             foreach ($columns as $column) {
527
-                $column = $this->isReserved($column) ? '"' . $column . '"' : $column;
527
+                $column = $this->isReserved($column) ? '"'.$column.'"' : $column;
528 528
 
529 529
                 if ((DB::connection()->getDriverName()) == 'oracle') {
530
-                    $query->orWhereRaw('LOWER(' . $column . ') like ? ESCAPE \'\\\'', ['%' . Security::escapeLike(strtolower($searchQuery)) . '%']);
530
+                    $query->orWhereRaw('LOWER('.$column.') like ? ESCAPE \'\\\'', ['%'.Security::escapeLike(strtolower($searchQuery)).'%']);
531 531
                 } else {
532
-                    $query->orwhere($column, 'like', '%' . Security::escapeLike($searchQuery,'\\\'') . '%');
532
+                    $query->orwhere($column, 'like', '%'.Security::escapeLike($searchQuery, '\\\'').'%');
533 533
                 }
534 534
 
535 535
             }
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
     {
541 541
         switch (DB::connection()->getDriverName()) {
542 542
             case 'pgsql':
543
-                $query       = "SELECT column_name FROM information_schema.columns WHERE table_name = '" . $this->getTable() . "'";
543
+                $query       = "SELECT column_name FROM information_schema.columns WHERE table_name = '".$this->getTable()."'";
544 544
                 $column_name = 'column_name';
545 545
                 $reverse     = true;
546 546
                 break;
547 547
 
548 548
             case 'mysql':
549
-                $query       = 'SHOW COLUMNS FROM ' . $this->getTable();
549
+                $query       = 'SHOW COLUMNS FROM '.$this->getTable();
550 550
                 $column_name = 'Field';
551 551
                 $reverse     = false;
552 552
                 break;
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
                 $parts       = explode('.', $this->getTable());
556 556
                 $num         = (count($parts) - 1);
557 557
                 $table       = $parts[$num];
558
-                $query       = "SELECT column_name FROM " . DB::connection()->getConfig('database') . ".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" . $table . "'";
558
+                $query       = "SELECT column_name FROM ".DB::connection()->getConfig('database').".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'".$table."'";
559 559
                 $column_name = 'column_name';
560 560
                 $reverse     = false;
561 561
                 break;
562 562
             case 'oracle':
563
-                $query       = 'SELECT COLUMN_NAME from ALL_TAB_COLUMNS WHERE TABLE_NAME=\'' . strtoupper($this->getTable()) . '\' AND DATA_TYPE <> \'CLOB\' AND DATA_TYPE <> \'NUMBER\' AND DATA_TYPE <> \'TIMESTAMP\'';
563
+                $query       = 'SELECT COLUMN_NAME from ALL_TAB_COLUMNS WHERE TABLE_NAME=\''.strtoupper($this->getTable()).'\' AND DATA_TYPE <> \'CLOB\' AND DATA_TYPE <> \'NUMBER\' AND DATA_TYPE <> \'TIMESTAMP\'';
564 564
                 $column_name = 'column_name';
565 565
                 $reverse     = false;
566 566
                 break;
567 567
             default:
568
-                $error = 'Database driver not supported: ' . DB::connection()->getConfig('driver');
568
+                $error = 'Database driver not supported: '.DB::connection()->getConfig('driver');
569 569
                 throw new Exception($error);
570 570
         }
571 571
 
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
 
585 585
     public function scopeBetweenCreate($query, $start, $end)
586 586
     {
587
-        return $query->whereBetween($this->getTable() . '.created_at', [$start, $end]);
587
+        return $query->whereBetween($this->getTable().'.created_at', [$start, $end]);
588 588
     }
589 589
 
590 590
     public function scopeBetweenUpdate($query, $start, $end)
591 591
     {
592
-        return $query->whereBetween($this->getTable() . '.updated_at', [$start, $end]);
592
+        return $query->whereBetween($this->getTable().'.updated_at', [$start, $end]);
593 593
     }
594 594
 
595 595
 
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Router/Router.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         // First, we will check to see if a controller prefix has been registered in
43 43
         // the route group. If it has, we will need to prefix it before trying to
44 44
         // reflect into the class instance and pull out the method for routing.
45
-        if (! empty($this->groupStack)) {
45
+        if (!empty($this->groupStack)) {
46 46
             $prepended = $this->prependGroupUses($controller);
47 47
         }
48 48
         $routable = (new ControllerInspector)
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Middleware/LanguageDetector.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      *
21 21
      * @param \Illuminate\Http\Request $request
22 22
      * @param \Closure $next
23
-     * @return mixed
23
+     * @return \Illuminate\Http\RedirectResponse
24 24
      */
25 25
     public function handle($request, Closure $next)
26 26
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         preg_match_all('/(\W|^)([a-z]{2})([^a-z]|$)/six', $request->server->get('HTTP_ACCEPT_LANGUAGE'), $m, PREG_PATTERN_ORDER);
29 29
 
30 30
         $user_langs = $m[2];
31
-        if (! empty($user_langs[0])) {
31
+        if (!empty($user_langs[0])) {
32 32
             $total = Language::where('iso', '=', $user_langs[0])->count();
33 33
             if ($total > 0) {
34 34
                 return redirect()->to('/'.$user_langs[0]);
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Middleware/Secure.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     public function handle($request, Closure $next)
25 25
     {
26 26
 
27
-        if (! $request->isSecure() and env('SECURE_COOKIE', false)) {
27
+        if (!$request->isSecure() and env('SECURE_COOKIE', false)) {
28 28
             if (strpos($request->getRequestUri(), '/storage/') === false) {
29 29
                 return redirect()->secure($request->getRequestUri());
30 30
             }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Middleware/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
         if (config('cache.enabled') === true) {
19 19
             $url = $request->url();
20 20
 
21
-            $key = md5($url . json_encode($request->query()));
22
-            $value = \Cache::remember($key, config('cache.minutes'), function () use ($next, $request) {
21
+            $key = md5($url.json_encode($request->query()));
22
+            $value = \Cache::remember($key, config('cache.minutes'), function() use ($next, $request) {
23 23
                 return $next($request);
24 24
             });
25 25
 
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Fondation/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public function storagePath()
32 32
     {
33
-        $path = env('STORAGE_PATH', $this->basePath . DIRECTORY_SEPARATOR . 'storage');
33
+        $path = env('STORAGE_PATH', $this->basePath.DIRECTORY_SEPARATOR.'storage');
34 34
 
35 35
         return $this->storagePath ?: $path;
36 36
     }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/ExpendableRouteServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
         \Route::group([
57 57
             'middleware' => 'web',
58 58
             'namespace'  => $this->namespace,
59
-        ], function ($router) {
59
+        ], function($router) {
60 60
 
61
-            require __DIR__ . '/../routes/web.php';
61
+            require __DIR__.'/../routes/web.php';
62 62
         });
63 63
     }
64 64
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
             'middleware' => 'api',
76 76
             'namespace'  => $this->namespace,
77 77
             'prefix'     => 'api',
78
-        ], function ($router) {
79
-            require __DIR__ . '/../routes/api.php';
78
+        ], function($router) {
79
+            require __DIR__.'/../routes/api.php';
80 80
         });
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
Distilleries/Expendable/Http/Middleware/AuthenticateOnceWithBasicAuth.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@
 block discarded – undo
16 16
      */
17 17
     public function handle($request, Closure $next, $guard = null)
18 18
     {
19
-        $ipsAuth = env('BASIC_AUTH_IP','');
20
-        $ipsAuth = explode(',',$ipsAuth);
19
+        $ipsAuth = env('BASIC_AUTH_IP', '');
20
+        $ipsAuth = explode(',', $ipsAuth);
21 21
 
22 22
 
23
-        if (env('BASIC_AUTH',false) == true)
23
+        if (env('BASIC_AUTH', false) == true)
24 24
         {
25
-            if(empty($ipsAuth) || !in_array($request->ip(),$ipsAuth))
25
+            if (empty($ipsAuth) || !in_array($request->ip(), $ipsAuth))
26 26
             {
27 27
                 return $this->auth->guard($guard)->basic() ?: $next($request);
28 28
             }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Helpers/UserUtils.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
     {
12 12
         $user = Auth::user();
13 13
 
14
-        if (empty($user)) return false;
14
+        if (empty($user)) {
15
+            return false;
16
+        }
15 17
 
16 18
         return Auth::user()->role->initials == '@sa' || Auth::user()->role->initials == '@a';
17 19
     }
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
     {
28 30
         $user = Auth::user();
29 31
 
30
-        if (empty($user)) return false;
32
+        if (empty($user)) {
33
+            return false;
34
+        }
31 35
 
32 36
         return in_array(Auth::user()->role->initials, self::frontendInitialRole());
33 37
     }
Please login to merge, or discard this patch.