Completed
Push — master ( 5d18d5...952510 )
by Maxime
04:18
created
Distilleries/Expendable/Http/Controllers/Backend/ComponentController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function getIndex()
30 30
     {
31
-        return redirect()->to(action('\\' . get_class($this) . '@getEdit'));
31
+        return redirect()->to(action('\\'.get_class($this).'@getEdit'));
32 32
     }
33 33
 
34 34
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
         }
71 71
 
72 72
         $libelle            = $request->get('libelle');
73
-        $libelle_form       = $libelle . 'Form';
74
-        $libelle_datatable  = $libelle . 'Datatable';
75
-        $libelle_controller = $libelle . 'Controller';
73
+        $libelle_form       = $libelle.'Form';
74
+        $libelle_datatable  = $libelle.'Datatable';
75
+        $libelle_controller = $libelle.'Controller';
76 76
         $model              = $request->get('models');
77 77
         $states             = $request->get('state');
78 78
 
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
             {
83 83
                 $this->artisan->call('datatable:make', [
84 84
                     '--fields' => $request->get('colon_datatable'),
85
-                    'name'     => 'Http/Datatables/' . $libelle_datatable
85
+                    'name'     => 'Http/Datatables/'.$libelle_datatable
86 86
                 ]);
87 87
             } else if (strpos($state, 'FormStateContract') !== false)
88 88
             {
89 89
 
90 90
                 $this->artisan->call('make:form', [
91 91
                     '--fields' => $request->get('fields_form'),
92
-                    'name'     => 'Http/Forms/' . $libelle_form
92
+                    'name'     => 'Http/Forms/'.$libelle_form
93 93
                 ]);
94 94
             }
95 95
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             '--model'     => $model,
100 100
             '--datatable' => $libelle_datatable,
101 101
             '--form'      => $libelle_form,
102
-            'name'        => 'Http/Controllers/Backend/' . $libelle_controller
102
+            'name'        => 'Http/Controllers/Backend/'.$libelle_controller
103 103
         ]);
104 104
 
105 105
         return redirect()->back()->with(Message::MESSAGE, [trans('expendable::success.generated')]);
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Models/BaseModel.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
     public function scopeSearch($query, $searchQuery)
31 31
     {
32 32
 
33
-        return $query->where(function ($query) use ($searchQuery) {
33
+        return $query->where(function($query) use ($searchQuery) {
34 34
             $columns = $this->getAllColumnsNames();
35 35
 
36 36
             foreach ($columns as $column) {
37
-                $column = $this->isReserved($column) ? '"' . $column . '"' : $column;
37
+                $column = $this->isReserved($column) ? '"'.$column.'"' : $column;
38 38
 
39 39
                 if ((DB::connection()->getDriverName()) == 'oracle') {
40
-                    $query->orWhereRaw('LOWER(' . $column . ') like ? ESCAPE \'\\\'', ['%' . Security::escapeLike(strtolower($searchQuery)) . '%']);
40
+                    $query->orWhereRaw('LOWER('.$column.') like ? ESCAPE \'\\\'', ['%'.Security::escapeLike(strtolower($searchQuery)).'%']);
41 41
                 } else {
42
-                    $query->orwhere($column, 'like', '%' . Security::escapeLike($searchQuery,'\\\'') . '%');
42
+                    $query->orwhere($column, 'like', '%'.Security::escapeLike($searchQuery, '\\\'').'%');
43 43
                 }
44 44
 
45 45
             }
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
     {
51 51
         switch (DB::connection()->getDriverName()) {
52 52
             case 'pgsql':
53
-                $query       = "SELECT column_name FROM information_schema.columns WHERE table_name = '" . $this->getTable() . "'";
53
+                $query       = "SELECT column_name FROM information_schema.columns WHERE table_name = '".$this->getTable()."'";
54 54
                 $column_name = 'column_name';
55 55
                 $reverse     = true;
56 56
                 break;
57 57
 
58 58
             case 'sqlite':
59
-                $query       = "PRAGMA table_info('" . $this->getTable()."')";
59
+                $query       = "PRAGMA table_info('".$this->getTable()."')";
60 60
                 $column_name = 'name';
61 61
                 $reverse     = true;
62 62
                 break;
63 63
 
64 64
 
65 65
             case 'mysql':
66
-                $query       = 'SHOW COLUMNS FROM ' . $this->getTable();
66
+                $query       = 'SHOW COLUMNS FROM '.$this->getTable();
67 67
                 $column_name = 'Field';
68 68
                 $reverse     = false;
69 69
                 break;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
                 $parts       = explode('.', $this->getTable());
73 73
                 $num         = (count($parts) - 1);
74 74
                 $table       = $parts[$num];
75
-                $query       = "SELECT column_name FROM " . DB::connection()->getConfig('database') . ".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" . $table . "'";
75
+                $query       = "SELECT column_name FROM ".DB::connection()->getConfig('database').".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'".$table."'";
76 76
                 $column_name = 'column_name';
77 77
                 $reverse     = false;
78 78
                 break;
79 79
             case 'oracle':
80
-                $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\'';
80
+                $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\'';
81 81
                 $column_name = 'column_name';
82 82
                 $reverse     = false;
83 83
                 break;
84 84
             default:
85
-                $error = 'Database driver not supported: ' . DB::connection()->getConfig('driver');
85
+                $error = 'Database driver not supported: '.DB::connection()->getConfig('driver');
86 86
                 throw new Exception($error);
87 87
         }
88 88
 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
     public function scopeBetweenCreate($query, $start, $end)
103 103
     {
104
-        return $query->whereBetween($this->getTable() . '.created_at', [$start, $end]);
104
+        return $query->whereBetween($this->getTable().'.created_at', [$start, $end]);
105 105
     }
106 106
 
107 107
     public function scopeBetweenUpdate($query, $start, $end)
108 108
     {
109
-        return $query->whereBetween($this->getTable() . '.updated_at', [$start, $end]);
109
+        return $query->whereBetween($this->getTable().'.updated_at', [$start, $end]);
110 110
     }
111 111
 
112 112
 
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Forms/Role/RoleForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 
42 42
     protected function getUpdateRules()
43 43
     {
44
-        $key                           = \Request::get($this->model->getKeyName());
45
-        static::$rules_update['initials'] = 'required|unique:roles,initials,' . $key;
44
+        $key = \Request::get($this->model->getKeyName());
45
+        static::$rules_update['initials'] = 'required|unique:roles,initials,'.$key;
46 46
 
47 47
         return parent::getUpdateRules();
48 48
     }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Http/Forms/Component/ComponentForm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $allModels = [
49 49
             [
50
-                'path' => app_path() . DIRECTORY_SEPARATOR,
50
+                'path' => app_path().DIRECTORY_SEPARATOR,
51 51
                 'namespace' => '{{app}}',
52 52
             ],
53 53
             [
54
-                'path' => app_path() . DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR,
54
+                'path' => app_path().DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR,
55 55
                 'namespace' => '{{app}}Models\\',
56 56
             ],
57 57
             [
58
-                'path' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR,
58
+                'path' => __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR,
59 59
                 'namespace' => 'Distilleries\\Expendable\\Models\\',
60 60
             ],
61 61
         ];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                 foreach ($models as $model) {
68 68
                     $choice = explode('/', $model);
69 69
                     $model = preg_replace('/.php/i', '', last($choice));
70
-                    $choices[$config['namespace'] . $model] = $model;
70
+                    $choices[$config['namespace'].$model] = $model;
71 71
                 }
72 72
             }
73 73
 
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, $field = 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/Scopes/Translatable.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $translation = new Translation;
45 45
 
46
-        return $translation->getTable() . '.' . $translation->getIsoColumn();
46
+        return $translation->getTable().'.'.$translation->getIsoColumn();
47 47
     }
48 48
 
49 49
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $translation = new Translation;
57 57
 
58
-        return $translation->getTable() . '.' . $translation->getIdElementColumn();
58
+        return $translation->getTable().'.'.$translation->getIdElementColumn();
59 59
     }
60 60
 
61 61
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $translation = new Translation;
69 69
 
70
-        return $translation->getTable() . '.' . $translation->getModelColumn();
70
+        return $translation->getTable().'.'.$translation->getModelColumn();
71 71
     }
72 72
 
73 73
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $translation = new Translation;
81 81
 
82
-        return $translation->getTable() . '.' . $translation->getIdSourceColumn();
82
+        return $translation->getTable().'.'.$translation->getIdSourceColumn();
83 83
     }
84 84
 
85 85
     /**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             ->where($this->getQualifiedIsoColumn(), '=', $iso)->get();
103 103
 
104 104
         if (!$translation->isEmpty()) {
105
-            $translation->each(function($trans){
105
+            $translation->each(function($trans) {
106 106
                 $trans->delete();
107 107
             });
108 108
         }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Exports/BaseExport.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -32,6 +32,9 @@
 block discarded – undo
32 32
         $this->setRange($data);
33 33
     }
34 34
 
35
+    /**
36
+     * @param string $fileName
37
+     */
35 38
     public function export($fileName)
36 39
     {
37 40
         return $this->download($fileName);
Please login to merge, or discard this patch.
src/Distilleries/Expendable/Imports/BaseImport.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -20,6 +20,9 @@
 block discarded – undo
20 20
         $this->setModel($model);
21 21
     }
22 22
 
23
+    /**
24
+     * @param string $filepath
25
+     */
23 26
     public function importFromFile($filepath)
24 27
     {
25 28
         return $this->import($filepath);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function model(array $row)
32 32
     {
33 33
         $data = [];
34
-        foreach($this->model->getFillable() as $value)
34
+        foreach ($this->model->getFillable() as $value)
35 35
         {
36 36
             $data[$value] = $row[$value];
37 37
         }
Please login to merge, or discard this patch.
src/Distilleries/Expendable/States/ExportStateTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
         $dateStart = !empty($data['range']) && !empty($data['range']['start']) ? $data['range']['start'] : Carbon::now()->format('Y-m-d');
54 54
         $dateEnd = !empty($data['range']) && !empty($data['range']['end']) ? $data['range']['end'] : Carbon::now()->format('Y-m-d');
55 55
         $type = !empty($data['type']) ? $data['type'] : 'csv';
56
-        $filename = str_replace('/', '-', $dateStart . '_' . $dateEnd) . '.' . mb_strtolower($type);
56
+        $filename = str_replace('/', '-', $dateStart.'_'.$dateEnd).'.'.mb_strtolower($type);
57 57
 
58 58
         return (new BaseExport($this->model, $data))->export($filename);
59 59
     }
Please login to merge, or discard this patch.