@@ -28,27 +28,27 @@ |
||
| 28 | 28 | public function register() |
| 29 | 29 | { |
| 30 | 30 | //Bind Core Facade to the Service Container |
| 31 | - $this->app->singleton('Core', function () { |
|
| 31 | + $this->app->singleton('Core', function() { |
|
| 32 | 32 | return new \App\Modules\Core\Core; |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | 35 | //Bind Errors Facade to the Service Container |
| 36 | - $this->app->singleton('Errors', function () { |
|
| 36 | + $this->app->singleton('Errors', function() { |
|
| 37 | 37 | return new \App\Modules\Core\Errors\Errors; |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | 40 | //Bind CoreConfig Facade to the Service Container |
| 41 | - $this->app->singleton('CoreConfig', function () { |
|
| 41 | + $this->app->singleton('CoreConfig', function() { |
|
| 42 | 42 | return new \App\Modules\Core\Utl\CoreConfig; |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | 45 | //Bind Media Facade to the Service Container |
| 46 | - $this->app->singleton('Media', function () { |
|
| 46 | + $this->app->singleton('Media', function() { |
|
| 47 | 47 | return new \App\Modules\Core\Utl\Media; |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | 50 | //Bind ApiConsumer Facade to the Service Container |
| 51 | - $this->app->singleton('ApiConsumer', function () { |
|
| 51 | + $this->app->singleton('ApiConsumer', function() { |
|
| 52 | 52 | $app = app(); |
| 53 | 53 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
| 54 | 54 | }); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->container['slug'] = Str::slug($this->argument('slug')); |
| 91 | 91 | $this->container['name'] = Str::studly($this->container['slug']); |
| 92 | 92 | $this->container['version'] = '1.0'; |
| 93 | - $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.'; |
|
| 93 | + $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.'; |
|
| 94 | 94 | $this->container['location'] = config('modules.default_location'); |
| 95 | 95 | $this->container['provider'] = config("modules.locations.{$this->container['location']}.provider"); |
| 96 | 96 | $this->container['basename'] = Str::studly($this->container['slug']); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $progress->finish(); |
| 125 | 125 | |
| 126 | - event($this->container['slug'] . '.module.made'); |
|
| 126 | + event($this->container['slug'].'.module.made'); |
|
| 127 | 127 | |
| 128 | 128 | $this->info("\nModule generated successfully."); |
| 129 | 129 | } |
@@ -138,18 +138,18 @@ discard block |
||
| 138 | 138 | $manifest = config("modules.locations.$location.manifest") ?: 'module.json'; |
| 139 | 139 | $provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider'; |
| 140 | 140 | |
| 141 | - if (!$this->files->isDirectory($root)) { |
|
| 141 | + if ( ! $this->files->isDirectory($root)) { |
|
| 142 | 142 | $this->files->makeDirectory($root); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $directory = module_path(null, $this->container['basename'], $location); |
| 146 | - $source = __DIR__ . '/Stubs/Module'; |
|
| 146 | + $source = __DIR__.'/Stubs/Module'; |
|
| 147 | 147 | |
| 148 | 148 | $this->files->makeDirectory($directory); |
| 149 | 149 | |
| 150 | 150 | $sourceFiles = $this->files->allFiles($source, true); |
| 151 | 151 | |
| 152 | - if (!empty($this->mapping)) { |
|
| 152 | + if ( ! empty($this->mapping)) { |
|
| 153 | 153 | $search = array_keys($this->mapping); |
| 154 | 154 | $replace = array_values($this->mapping); |
| 155 | 155 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | $contents = $this->replacePlaceholders($file->getContents()); |
| 159 | 159 | $subPath = $file->getRelativePathname(); |
| 160 | 160 | |
| 161 | - if (!empty($this->mapping)) { |
|
| 161 | + if ( ! empty($this->mapping)) { |
|
| 162 | 162 | $subPath = str_replace($search, $replace, $subPath); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $filePath = $directory . '/' . $subPath; |
|
| 165 | + $filePath = $directory.'/'.$subPath; |
|
| 166 | 166 | |
| 167 | 167 | // if the file is module.json, replace it with the custom manifest file name |
| 168 | 168 | if ($file->getFilename() === 'module.json' && $manifest) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $dir = dirname($filePath); |
| 179 | 179 | |
| 180 | - if (! $this->files->isDirectory($dir)) { |
|
| 180 | + if ( ! $this->files->isDirectory($dir)) { |
|
| 181 | 181 | $this->files->makeDirectory($dir, 0755, true); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -211,21 +211,21 @@ discard block |
||
| 211 | 211 | ]; |
| 212 | 212 | |
| 213 | 213 | $replace = [ |
| 214 | - ucfirst($modelNameSingular) . 'Factory', |
|
| 214 | + ucfirst($modelNameSingular).'Factory', |
|
| 215 | 215 | $modelNameSingular, |
| 216 | 216 | $this->container['slug'], |
| 217 | 217 | ucfirst($modelName), |
| 218 | 218 | ucfirst($modelNameSingular), |
| 219 | - ucfirst($modelName) . 'DatabaseSeeder', |
|
| 220 | - ucfirst($modelName) . 'TableSeeder', |
|
| 221 | - ucfirst($modelNameSingular) . 'Controller', |
|
| 222 | - ucfirst($modelNameSingular) . 'Service', |
|
| 223 | - ucfirst($modelNameSingular) . 'Repository', |
|
| 224 | - ucfirst($modelName) . 'Errors', |
|
| 225 | - 'Insert' . ucfirst($modelNameSingular), |
|
| 226 | - 'Update' . ucfirst($modelNameSingular), |
|
| 219 | + ucfirst($modelName).'DatabaseSeeder', |
|
| 220 | + ucfirst($modelName).'TableSeeder', |
|
| 221 | + ucfirst($modelNameSingular).'Controller', |
|
| 222 | + ucfirst($modelNameSingular).'Service', |
|
| 223 | + ucfirst($modelNameSingular).'Repository', |
|
| 224 | + ucfirst($modelName).'Errors', |
|
| 225 | + 'Insert'.ucfirst($modelNameSingular), |
|
| 226 | + 'Update'.ucfirst($modelNameSingular), |
|
| 227 | 227 | ucfirst($modelNameSingular), |
| 228 | - ucfirst($modelNameSingular) . 'Observer', |
|
| 228 | + ucfirst($modelNameSingular).'Observer', |
|
| 229 | 229 | $modelName, |
| 230 | 230 | $modelName, |
| 231 | 231 | ]; |
@@ -247,6 +247,6 @@ discard block |
||
| 247 | 247 | protected function generateMigration() |
| 248 | 248 | { |
| 249 | 249 | $modelName = $this->container['slug']; |
| 250 | - return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $modelName . '_table']); |
|
| 250 | + return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$modelName.'_table']); |
|
| 251 | 251 | } |
| 252 | 252 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function getRoutes() |
| 92 | 92 | { |
| 93 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
| 93 | + return collect(\Route::getRoutes())->map(function($route) { |
|
| 94 | 94 | if (strpos($route->uri(), 'api/') !== false) { |
| 95 | 95 | return [ |
| 96 | 96 | 'method' => $route->methods()[0], |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | ]; |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
| 124 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
| 125 | 125 | $route['headers']['Authorization'] = 'Bearer {token}'; |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if (count($parameters)) { |
| 170 | 170 | $className = optional($reflectionMethod->getParameters()[0]->getType())->getName(); |
| 171 | 171 | if ($className) { |
| 172 | - $reflectionClass = new \ReflectionClass($className); |
|
| 172 | + $reflectionClass = new \ReflectionClass($className); |
|
| 173 | 173 | |
| 174 | 174 | if ($reflectionClass->hasMethod('rules')) { |
| 175 | 175 | $reflectionMethod = $reflectionClass->getMethod('rules'); |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | $errors = []; |
| 198 | 198 | foreach (\Module::all() as $module) { |
| 199 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
| 200 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
| 199 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
| 200 | + $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors'; |
|
| 201 | 201 | $reflectionClass = new \ReflectionClass($class); |
| 202 | 202 | foreach ($reflectionClass->getMethods() as $method) { |
| 203 | 203 | $methodName = $method->name; |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | public function __call($name, $arguments) |
| 20 | 20 | { |
| 21 | 21 | foreach (\Module::all() as $module) { |
| 22 | - $nameSpace = 'App\\Modules\\' . $module['basename']; |
|
| 23 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
| 22 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
| 23 | + $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors'; |
|
| 24 | 24 | |
| 25 | 25 | if (class_exists($class)) { |
| 26 | 26 | $class = \App::make($class); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $permissions = []; |
| 68 | 68 | $user = $this->repo->find(\Auth::id(), $relations); |
| 69 | 69 | foreach ($user->roles as $role) { |
| 70 | - $role->permissions->each(function ($permission) use (&$permissions) { |
|
| 70 | + $role->permissions->each(function($permission) use (&$permissions) { |
|
| 71 | 71 | $permissions[$permission->repo][$permission->id] = $permission->name; |
| 72 | 72 | }); |
| 73 | 73 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function assignRoles($userId, $roleIds) |
| 131 | 131 | { |
| 132 | 132 | $user = false; |
| 133 | - \DB::transaction(function () use ($userId, $roleIds, &$user) { |
|
| 133 | + \DB::transaction(function() use ($userId, $roleIds, &$user) { |
|
| 134 | 134 | $user = $this->repo->find($userId); |
| 135 | 135 | $this->repo->detachPermissions($userId); |
| 136 | 136 | $this->repo->attachPermissions($userId, $roleIds); |
@@ -149,15 +149,15 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function login($email, $password, $adminLogin = false) |
| 151 | 151 | { |
| 152 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
| 152 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
| 153 | 153 | \Errors::loginFailed(); |
| 154 | 154 | } elseif ($adminLogin && ! $this->hasRoles(['Admin'], $user)) { |
| 155 | 155 | \Errors::loginFailed(); |
| 156 | - } elseif (! $adminLogin && $this->hasRoles(['Admin'], $user)) { |
|
| 156 | + } elseif ( ! $adminLogin && $this->hasRoles(['Admin'], $user)) { |
|
| 157 | 157 | \Errors::loginFailed(); |
| 158 | 158 | } elseif ($user->blocked) { |
| 159 | 159 | \Errors::userIsBlocked(); |
| 160 | - } elseif (! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
| 160 | + } elseif ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) { |
|
| 161 | 161 | \Errors::emailNotConfirmed(); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | $access_token = $authCode ? Arr::get(\Socialite::driver($type)->getAccessTokenResponse($authCode), 'access_token') : $accessToken; |
| 178 | 178 | $user = \Socialite::driver($type)->userFromToken($access_token); |
| 179 | 179 | |
| 180 | - if (! $user->email) { |
|
| 180 | + if ( ! $user->email) { |
|
| 181 | 181 | \Errors::noSocialEmail(); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if (! $this->repo->first(['email' => $user->email])) { |
|
| 184 | + if ( ! $this->repo->first(['email' => $user->email])) { |
|
| 185 | 185 | $this->register($user->email, '', true); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | 'confirmed' => $skipConfirmEmail |
| 207 | 207 | ]); |
| 208 | 208 | |
| 209 | - if (! $skipConfirmEmail && ! config('skeleton.disable_confirm_email')) { |
|
| 209 | + if ( ! $skipConfirmEmail && ! config('skeleton.disable_confirm_email')) { |
|
| 210 | 210 | $this->sendConfirmationEmail($user->email); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function sendReset($email) |
| 249 | 249 | { |
| 250 | - if (! $user = $this->repo->first(['email' => $email])) { |
|
| 250 | + if ( ! $user = $this->repo->first(['email' => $email])) { |
|
| 251 | 251 | \Errors::notFound('email'); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | 'password' => $password, |
| 272 | 272 | 'password_confirmation' => $passwordConfirmation, |
| 273 | 273 | 'token' => $token |
| 274 | - ], function ($user, $password) { |
|
| 274 | + ], function($user, $password) { |
|
| 275 | 275 | $this->repo->save(['id' => $user->id, 'password' => $password]); |
| 276 | 276 | }); |
| 277 | 277 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | public function changePassword($password, $oldPassword) |
| 305 | 305 | { |
| 306 | 306 | $user = \Auth::user(); |
| 307 | - if (! \Hash::check($oldPassword, $user->password)) { |
|
| 307 | + if ( ! \Hash::check($oldPassword, $user->password)) { |
|
| 308 | 308 | \Errors::invalidOldPassword(); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | public function confirmEmail($confirmationCode) |
| 321 | 321 | { |
| 322 | - if (! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
| 322 | + if ( ! $user = $this->repo->first(['confirmation_code' => $confirmationCode])) { |
|
| 323 | 323 | \Errors::invalidConfirmationCode(); |
| 324 | 324 | } |
| 325 | 325 | |