Passed
Push — master ( 123176...12c361 )
by Reza
04:14
created
src/Commands/Actions/MakeCRUD.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,9 @@
 block discarded – undo
15 15
     public function handle()
16 16
     {
17 17
         $names = $this->argument('name') ?
18
-            [$this->argument('name')] :
19
-            CRUD::query()->where('active', true)->pluck('name')->toArray();
18
+            [$this->argument('name')] : CRUD::query()->where('active', true)->pluck('name')->toArray();
20 19
 
21
-        if(is_null($names)) {
20
+        if (is_null($names)) {
22 21
             throw new CommandNotFoundException("There is no action in config file");
23 22
         }
24 23
 
Please login to merge, or discard this patch.
database/migrations/2021_07_17_99999_create_cruds_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('cruds', function (Blueprint $table) {
16
+        Schema::create('cruds', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('name')->unique();
19 19
             $table->string('model')->unique();
Please login to merge, or discard this patch.
src/Commands/Actions/MakeCRUDConfig.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
         $path = base_path("app/CRUD/{$name}Component.php");
26 26
 
27
-        if($this->files->exists($path) and !$this->option('force')){
27
+        if ($this->files->exists($path) and !$this->option('force')) {
28 28
             $this->warn("'{$name}Component.php' already exists in CRUD directory");
29 29
             return;
30 30
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $model = $this->qualifyModel($this->getNameInput());
63 63
 
64
-        if(!class_exists($model)){
64
+        if (!class_exists($model)) {
65 65
             $this->warn("Model option should be valid and model should be exist");
66 66
             die();
67 67
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     private function withAuth()
73 73
     {
74 74
         $fillableList = $this->getFillableList();
75
-        if(!in_array('user_id', $fillableList)){
75
+        if (!in_array('user_id', $fillableList)) {
76 76
             return 'true';
77 77
         }
78 78
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $fillableList = $this->getFillableList();
92 92
         $array = [];
93
-        foreach ($fillableList as $fillable){
94
-            if(!Str::contains($fillable, 'id')){
93
+        foreach ($fillableList as $fillable) {
94
+            if (!Str::contains($fillable, 'id')) {
95 95
                 $array[] = "'$fillable'";
96 96
             }
97 97
         }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +12 added lines, -12 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,17 +11,17 @@  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
         $namespace = "\\App\\CRUD\\{$name}Component";
17 17
 
18
-        if (!class_exists($namespace)){
18
+        if (!class_exists($namespace)) {
19 19
             abort(403, "Class with {$namespace} namespace doesn't exist");
20 20
         }
21 21
 
22 22
         $instance = app()->make($namespace);
23 23
 
24
-        if (!$instance instanceof CRUDComponent){
24
+        if (!$instance instanceof CRUDComponent) {
25 25
             abort(403, "{$namespace} should implement CRUDComponent interface");
26 26
         }
27 27
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
     }
30 30
 }
31 31
 
32
-if(! function_exists('crud')) {
33
-    function crud($name){
32
+if (!function_exists('crud')) {
33
+    function crud($name) {
34 34
         return \EasyPanel\Models\CRUD::query()->where('name', $name)->first();
35 35
     }
36 36
 }
37 37
 
38
-if(! function_exists('get_icon')) {
39
-    function get_icon($type){
38
+if (!function_exists('get_icon')) {
39
+    function get_icon($type) {
40 40
         $array = [
41 41
             'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'],
42 42
             'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'],
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
             'truck' => ['product', 'products', 'shops', 'shop'],
54 54
             'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'],
55 55
         ];
56
-        foreach ($array as $key => $arrayValues){
57
-            if(in_array($type, $arrayValues)){
56
+        foreach ($array as $key => $arrayValues) {
57
+            if (in_array($type, $arrayValues)) {
58 58
                 $val = $key;
59 59
             }
60 60
         }
Please login to merge, or discard this patch.