@@ -126,26 +126,26 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | // Publish Config File |
| 128 | 128 | $this->publishes([ |
| 129 | - __DIR__ . '/../../config/adminetic.php' => config_path('adminetic.php'), |
|
| 129 | + __DIR__.'/../../config/adminetic.php' => config_path('adminetic.php'), |
|
| 130 | 130 | ], 'adminetic-config'); |
| 131 | 131 | // Publish View Files |
| 132 | 132 | $this->publishes([ |
| 133 | - __DIR__ . '/../../resources/views' => resource_path('views/vendor/adminetic'), |
|
| 133 | + __DIR__.'/../../resources/views' => resource_path('views/vendor/adminetic'), |
|
| 134 | 134 | ], 'adminetic-views'); |
| 135 | 135 | // Publish Migration Files |
| 136 | 136 | $this->publishes([ |
| 137 | - __DIR__ . '/../../database/migrations' => database_path('migrations'), |
|
| 137 | + __DIR__.'/../../database/migrations' => database_path('migrations'), |
|
| 138 | 138 | ], 'adminetic-migrations'); |
| 139 | 139 | // Publish Database Seeds |
| 140 | 140 | $this->publishes([ |
| 141 | - __DIR__ . '/../../database/seeders' => database_path('seeders'), |
|
| 141 | + __DIR__.'/../../database/seeders' => database_path('seeders'), |
|
| 142 | 142 | ], 'adminetic-seeders'); |
| 143 | 143 | $this->publishes([ |
| 144 | - __DIR__ . '/../../payload/assets' => public_path('adminetic/assets'), |
|
| 144 | + __DIR__.'/../../payload/assets' => public_path('adminetic/assets'), |
|
| 145 | 145 | ], 'adminetic-assets-files'); |
| 146 | 146 | // Publish Static Files |
| 147 | 147 | $this->publishes([ |
| 148 | - __DIR__ . '/../../payload/static' => public_path('adminetic/static'), |
|
| 148 | + __DIR__.'/../../payload/static' => public_path('adminetic/static'), |
|
| 149 | 149 | ], 'adminetic-static-files'); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function registerResource() |
| 158 | 158 | { |
| 159 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); // Loading Migration Files |
|
| 160 | - $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'adminetic'); // Loading Views Files |
|
| 159 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); // Loading Migration Files |
|
| 160 | + $this->loadViewsFrom(__DIR__.'/../../resources/views', 'adminetic'); // Loading Views Files |
|
| 161 | 161 | $this->registerRoutes(); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function registerRoutes() |
| 170 | 170 | { |
| 171 | - Route::group($this->routeConfiguration(), function () { |
|
| 172 | - $this->loadRoutesFrom(__DIR__ . '/../../routes/web.php'); |
|
| 171 | + Route::group($this->routeConfiguration(), function() { |
|
| 172 | + $this->loadRoutesFrom(__DIR__.'/../../routes/web.php'); |
|
| 173 | 173 | }); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function directives() |
| 214 | 214 | { |
| 215 | - Blade::if('hasRole', function ($roles) { |
|
| 215 | + Blade::if ('hasRole', function($roles) { |
|
| 216 | 216 | $hasAccess = false; |
| 217 | 217 | $roles_array = explode('|', $roles); |
| 218 | 218 | foreach ($roles_array as $role) { |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return $hasAccess; |
| 223 | 223 | }); |
| 224 | - Blade::if('preference', function ($preference_name, $default_value) { |
|
| 224 | + Blade::if ('preference', function($preference_name, $default_value) { |
|
| 225 | 225 | return preference($preference_name, $default_value); |
| 226 | 226 | }); |
| 227 | - Blade::directive('setting', function ($setting_name) { |
|
| 227 | + Blade::directive('setting', function($setting_name) { |
|
| 228 | 228 | return "<?php echo setting($setting_name) ?>"; |
| 229 | 229 | }); |
| 230 | 230 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | protected function getFacades() |
| 305 | 305 | { |
| 306 | - $this->app->bind('adminetic', function ($app) { |
|
| 306 | + $this->app->bind('adminetic', function($app) { |
|
| 307 | 307 | return new Adminetic(); |
| 308 | 308 | }); |
| 309 | 309 | } |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | protected static function makeViews($name, $console) |
| 70 | 70 | { |
| 71 | 71 | $lowername = strtolower($name); |
| 72 | - if (!file_exists($path = resource_path('views/admin/' . $lowername))) { |
|
| 72 | + if (!file_exists($path = resource_path('views/admin/'.$lowername))) { |
|
| 73 | 73 | mkdir($path, 0777, true); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (!file_exists($path = resource_path('views/admin/layouts/modules/' . $lowername))) { |
|
| 76 | + if (!file_exists($path = resource_path('views/admin/layouts/modules/'.$lowername))) { |
|
| 77 | 77 | mkdir($path, 0777, true); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | // Make Other neccesary CRUD files |
| 173 | 173 | protected static function makeOthers($name, $console) |
| 174 | 174 | { |
| 175 | - Artisan::call('make:migration create_' . strtolower(Str::plural($name)) . '_table --create=' . strtolower(Str::plural($name))); |
|
| 176 | - $console->info('Migration file created named create_' . strtolower(Str::plural($name)) . '_table ... ✅'); |
|
| 175 | + Artisan::call('make:migration create_'.strtolower(Str::plural($name)).'_table --create='.strtolower(Str::plural($name))); |
|
| 176 | + $console->info('Migration file created named create_'.strtolower(Str::plural($name)).'_table ... ✅'); |
|
| 177 | 177 | |
| 178 | - Artisan::call('make:seeder ' . $name . 'Seeder'); |
|
| 178 | + Artisan::call('make:seeder '.$name.'Seeder'); |
|
| 179 | 179 | $console->info('Seeder file created ... ✅'); |
| 180 | 180 | |
| 181 | - Artisan::call('make:repo ' . $name); |
|
| 181 | + Artisan::call('make:repo '.$name); |
|
| 182 | 182 | $console->info('Repository and Interface created ... ✅'); |
| 183 | 183 | |
| 184 | - Artisan::call('make:request ' . $name . 'Request'); |
|
| 184 | + Artisan::call('make:request '.$name.'Request'); |
|
| 185 | 185 | $console->info('Request file created ... ✅'); |
| 186 | 186 | } |
| 187 | 187 | // Make Other Necessary CRUD Files |
@@ -190,34 +190,34 @@ discard block |
||
| 190 | 190 | // Adding Route |
| 191 | 191 | $lowercased_name = strtolower($name); |
| 192 | 192 | $route = "Route::resource('admin/{$lowercased_name}',\App\Http\Controllers\Admin\\{$name}Controller::class);"; |
| 193 | - file_put_contents('routes/web.php', "\n", FILE_APPEND | LOCK_EX); |
|
| 194 | - file_put_contents('routes/web.php', $route, FILE_APPEND | LOCK_EX); |
|
| 193 | + file_put_contents('routes/web.php', "\n", FILE_APPEND | LOCK_EX); |
|
| 194 | + file_put_contents('routes/web.php', $route, FILE_APPEND | LOCK_EX); |
|
| 195 | 195 | |
| 196 | 196 | $console->info('Route added to web.php ... ✅'); |
| 197 | 197 | |
| 198 | 198 | // Adding Route Interface Binding |
| 199 | - $repository_interface_binding = '$this->app->bind(\App\Contracts\\' . $name . 'RepositoryInterface::class, \App\Repositories\\' . $name . 'Repository::class);'; |
|
| 199 | + $repository_interface_binding = '$this->app->bind(\App\Contracts\\'.$name.'RepositoryInterface::class, \App\Repositories\\'.$name.'Repository::class);'; |
|
| 200 | 200 | $provider_path = app_path('Providers/AdminServiceProvider.php'); |
| 201 | 201 | putContentToClassFunction($provider_path, 'protected function repos', $repository_interface_binding); |
| 202 | 202 | |
| 203 | 203 | // Adding Module To Menu |
| 204 | - $menu_content = "],[\n" . |
|
| 205 | - "'type' => 'menu',\n" . |
|
| 206 | - "'name' => '$name',\n" . |
|
| 207 | - "'icon' => 'fa fa-wrench',\n" . |
|
| 208 | - "'is_active' => request()->routeIs('$lowercased_name*') ? 'active' : '',\n" . |
|
| 209 | - "'conditions' => [\n" . |
|
| 210 | - "[\n" . |
|
| 211 | - "'type' => 'or',\n" . |
|
| 212 | - "'condition' => auth()->user()->can('view-any', \App\Models\Admin\\" . $name . "::class),\n" . |
|
| 213 | - "],\n" . |
|
| 214 | - "[\n" . |
|
| 215 | - "'type' => 'or',\n" . |
|
| 216 | - "'condition' => auth()->user()->can('create', \App\Models\Admin\\" . $name . "::class),\n" . |
|
| 217 | - "],\n" . |
|
| 204 | + $menu_content = "],[\n". |
|
| 205 | + "'type' => 'menu',\n". |
|
| 206 | + "'name' => '$name',\n". |
|
| 207 | + "'icon' => 'fa fa-wrench',\n". |
|
| 208 | + "'is_active' => request()->routeIs('$lowercased_name*') ? 'active' : '',\n". |
|
| 209 | + "'conditions' => [\n". |
|
| 210 | + "[\n". |
|
| 211 | + "'type' => 'or',\n". |
|
| 212 | + "'condition' => auth()->user()->can('view-any', \App\Models\Admin\\".$name."::class),\n". |
|
| 213 | + "],\n". |
|
| 214 | + "[\n". |
|
| 215 | + "'type' => 'or',\n". |
|
| 216 | + "'condition' => auth()->user()->can('create', \App\Models\Admin\\".$name."::class),\n". |
|
| 217 | + "],\n". |
|
| 218 | 218 | "],\n"; |
| 219 | - $menu_content = $menu_content . '"children" => $this->indexCreateChildren("' . $lowercased_name . '", \App\Models\Admin\\' . $name . '::class),'; |
|
| 220 | - $menu_content = "\n" . $menu_content . "\n"; |
|
| 219 | + $menu_content = $menu_content.'"children" => $this->indexCreateChildren("'.$lowercased_name.'", \App\Models\Admin\\'.$name.'::class),'; |
|
| 220 | + $menu_content = "\n".$menu_content."\n"; |
|
| 221 | 221 | $menu_path = app_path("Services/MyMenu.php"); |
| 222 | 222 | putContentToClassFunction($menu_path, 'return [', $menu_content, ']'); |
| 223 | 223 | |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | protected static function fileMadeSuccess($console, $file, $type) |
| 228 | 228 | { |
| 229 | 229 | if (file_exists($file)) { |
| 230 | - $console->info($type . ' created successfully ... ✅'); |
|
| 230 | + $console->info($type.' created successfully ... ✅'); |
|
| 231 | 231 | } else { |
| 232 | - $console->error('Failed to create ' . $type . ' ...'); |
|
| 232 | + $console->error('Failed to create '.$type.' ...'); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | { |
| 56 | 56 | if (!is_null($this->delete_limit)) { |
| 57 | 57 | Activity::whereDate('created_at', '<', Carbon::now()->subDays($this->delete_limit))->delete(); |
| 58 | - $this->emit('activity_success', 'All activities Deleted except last ' . $this->delete_limit . 'days activities'); |
|
| 58 | + $this->emit('activity_success', 'All activities Deleted except last '.$this->delete_limit.'days activities'); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $profile = $p ?? Auth::user()->profile ?? Auth::user()->profile()->create(); |
| 82 | 82 | |
| 83 | - return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/' . $profile->profile_pic)) : asset('adminetic/static/profile.gif'); |
|
| 83 | + return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/'.$profile->profile_pic)) : asset('adminetic/static/profile.gif'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if (!function_exists('random_color')) { |
| 151 | 151 | function random_color() |
| 152 | 152 | { |
| 153 | - return random_color_part() . random_color_part() . random_color_part(); |
|
| 153 | + return random_color_part().random_color_part().random_color_part(); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if (!function_exists('deleteImage')) { |
| 182 | 182 | function deleteImage($image) |
| 183 | 183 | { |
| 184 | - $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/' . $image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/' . $image)) : '') : ''; |
|
| 184 | + $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : ''; |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | function getImg($img, $default) |
| 241 | 241 | { |
| 242 | 242 | if (isset($img)) { |
| 243 | - if (file_exists(public_path('storage/' . $img))) { |
|
| 244 | - return asset('storage/' . $img); |
|
| 243 | + if (file_exists(public_path('storage/'.$img))) { |
|
| 244 | + return asset('storage/'.$img); |
|
| 245 | 245 | } elseif (file_exists(public_path($img))) { |
| 246 | 246 | return asset($img); |
| 247 | 247 | } else { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | if (!function_exists('putContentToClassFunction')) { |
| 257 | 257 | function putContentToClassFunction($file, $function_name, $data, $closing_token = "}") |
| 258 | 258 | { |
| 259 | - $data = $data . "\n"; |
|
| 259 | + $data = $data."\n"; |
|
| 260 | 260 | // Read the contents of the file into a string |
| 261 | 261 | $contents = file_get_contents($file); |
| 262 | 262 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $function_definition = substr($contents, $start_pos, $end_pos - $start_pos + 1); |
| 277 | 277 | |
| 278 | 278 | // Append the new content to the function definition |
| 279 | - $modified_function_definition = rtrim($function_definition, $closing_token) . $data . $closing_token; |
|
| 279 | + $modified_function_definition = rtrim($function_definition, $closing_token).$data.$closing_token; |
|
| 280 | 280 | |
| 281 | 281 | // Replace the original function definition with the modified one in the class definition |
| 282 | 282 | $modified_contents = substr_replace($contents, $modified_function_definition, $start_pos, $end_pos - $start_pos + 1); |