Passed
Push — master ( 828c81...f3bd4d )
by Reza
04:07
created
src/Http/Livewire/CRUD/Create.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $this->validate();
57 57
 
58
-        if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){
58
+        if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) {
59 59
             $this->addError('model', __('Namespace is invalid'));
60 60
 
61 61
             return;
62 62
         }
63 63
 
64
-        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){
64
+        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) {
65 65
             $this->addError('route', __('Route is invalid'));
66 66
 
67 67
             return;
68 68
         }
69 69
 
70
-        try{
70
+        try {
71 71
             $name = strtolower($this->getModelName($this->model));
72 72
             CRUD::create([
73 73
                 'model' => trim($this->model, '\\'),
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
                 '--force' => true
81 81
             ]);
82 82
 
83
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]);
84
-        } catch(\Exception $exception){
85
-            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]);
83
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]);
84
+        } catch (\Exception $exception) {
85
+            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]);
86 86
         }
87 87
 
88 88
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             ->layout('admin::layouts.app');
97 97
     }
98 98
 
99
-    private function getModelName($model){
99
+    private function getModelName($model) {
100 100
         $model = explode('\\', $model);
101 101
 
102 102
         return end($model);
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
         $files = File::exists(app_path('/Models')) ? File::files(app_path('/Models')) : File::allFiles(app_path('/'));
108 108
         $array = [];
109 109
         foreach ($files as $file) {
110
-            if (!Str::contains($file->getFilename(), '.php') or (!is_null($query) and !Str::contains(Str::lower($file->getFilename()), Str::lower($query)))){
110
+            if (!Str::contains($file->getFilename(), '.php') or (!is_null($query) and !Str::contains(Str::lower($file->getFilename()), Str::lower($query)))) {
111 111
                 continue;
112 112
             }
113 113
 
114 114
             $namespace = File::exists(app_path('/Models')) ? "App\\Models" : "\\App";
115 115
             $fileName = str_replace('.php', null, $file->getFilename());
116
-            $fullNamespace =  $namespace."\\{$fileName}";
116
+            $fullNamespace = $namespace."\\{$fileName}";
117 117
 
118 118
             if (app()->make($fullNamespace) instanceof Model) {
119 119
                 $array[] = $fullNamespace;
Please login to merge, or discard this patch.