Completed
Push — master ( 036137...7e131c )
by Reza
28s queued 25s
created
src/Parsers/StubParser.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
         $this->store = $store;
39 39
     }
40 40
 
41
-    public function setAuthType(bool $hasAuth){
41
+    public function setAuthType(bool $hasAuth) {
42 42
         $this->hasAuth = $hasAuth;
43 43
     }
44 44
 
45
-    public function setFields(array $fields){
45
+    public function setFields(array $fields) {
46 46
         $this->fields = $fields;
47 47
     }
48 48
 
49
-    public function setInputs(array $inputs){
49
+    public function setInputs(array $inputs) {
50 50
         $this->inputs = $inputs;
51 51
     }
52 52
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $fields = array_keys($this->inputs);
99 99
         $str = '';
100 100
 
101
-        if(in_array($this->inputName, $fields)){
101
+        if (in_array($this->inputName, $fields)) {
102 102
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
103 103
             die;
104 104
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $str = '';
119 119
         foreach ($this->inputs as $key => $input) {
120 120
             $inputObject = $this->normalizeInput($key, $input);
121
-            if (! $inputObject instanceof File){
121
+            if (!$inputObject instanceof File) {
122 122
                 continue;
123 123
             }
124 124
             // We get store path which has been defined in crud's config file
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 
175 175
         foreach ($this->inputs as $key => $field) {
176 176
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
177
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
177
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
178 178
         }
179 179
 
180
-        if($this->hasAuth){
180
+        if ($this->hasAuth) {
181 181
             $str .= "'user_id' => auth()->id(),";
182 182
         }
183 183
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Create Blade from stub
189 189
      */
190
-    public function parseBlade($stub){
190
+    public function parseBlade($stub) {
191 191
         $modelName = $this->getModelName($this->parsedModel);
192 192
 
193 193
         $crud = crud(strtolower($modelName));
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     /**
271 271
      * Tab Maker (Each tabs mean 4 space)
272 272
      */
273
-    public function makeTab($count, $newLine = true){
273
+    public function makeTab($count, $newLine = true) {
274 274
         $count = $count * 4;
275 275
         $tabs = str_repeat(' ', $count);
276 276
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
     public function normalizeField($field)
288 288
     {
289
-        if($field instanceof Field){
289
+        if ($field instanceof Field) {
290 290
             return $field;
291 291
         }
292 292
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
         return Field::title($title);
296 296
     }
297 297
 
298
-    public function normalizeInput($key, $input){
299
-        if ($input instanceof BaseInput){
298
+    public function normalizeInput($key, $input) {
299
+        if ($input instanceof BaseInput) {
300 300
             return $input;
301 301
         }
302 302
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 use EasyPanel\Contracts\CRUDComponent;
4 4
 
5
-if(! function_exists('getRouteName')) {
6
-    function getRouteName(){
5
+if (!function_exists('getRouteName')) {
6
+    function getRouteName() {
7 7
         $routeName = config('easy_panel.route_prefix');
8 8
         $routeName = trim($routeName, '/');
9 9
         $routeName = str_replace('/', '.', $routeName);
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
     }
12 12
 }
13 13
 
14
-if(! function_exists('getCrudConfig')) {
15
-    function getCrudConfig($name){
14
+if (!function_exists('getCrudConfig')) {
15
+    function getCrudConfig($name) {
16 16
         $className = ucwords($name);
17 17
         $namespace = "\\App\\CRUD\\{$className}Component";
18 18
         $appFilePath = app_path("/CRUD/{$name}Component.php");
19 19
         $nsExist = class_exists($namespace);
20 20
         $filePathExist = file_exists($appFilePath);
21 21
 
22
-        if (!$filePathExist or !$nsExist){
22
+        if (!$filePathExist or !$nsExist) {
23 23
             abort(403, "Class with {$namespace}  namespace or {$appFilePath} doesn't exist, ");
24 24
         }
25 25
 
26 26
         $instance = app()->make($namespace);
27 27
 
28
-        if (!$instance instanceof CRUDComponent){
28
+        if (!$instance instanceof CRUDComponent) {
29 29
             abort(403, "{$namespace} should implement CRUDComponent interface");
30 30
         }
31 31
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
     }
34 34
 }
35 35
 
36
-if(! function_exists('crud')) {
37
-    function crud($name){
36
+if (!function_exists('crud')) {
37
+    function crud($name) {
38 38
         return \EasyPanel\Models\CRUD::query()->where('name', $name)->first();
39 39
     }
40 40
 }
41 41
 
42
-if (! function_exists('hasPermission')) {
42
+if (!function_exists('hasPermission')) {
43 43
     function hasPermission($routeName, $withAcl, $withPolicy = false, $entity = []) {
44 44
         $showButton = true;
45 45
 
Please login to merge, or discard this patch.