@@ -168,6 +168,11 @@ discard block |
||
| 168 | 168 | $this->generateFile($path, $stub, $namespace); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | + /** |
|
| 172 | + * @param string $path |
|
| 173 | + * @param string $stub |
|
| 174 | + * @param null|string $namespace |
|
| 175 | + */ |
|
| 171 | 176 | public function generateFile($path, $stub, $namespace) |
| 172 | 177 | { |
| 173 | 178 | if (! $this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
@@ -197,6 +202,9 @@ discard block |
||
| 197 | 202 | return $path.'/Stubs/base/'.$stub.'.stub'; |
| 198 | 203 | } |
| 199 | 204 | |
| 205 | + /** |
|
| 206 | + * @param string $stub |
|
| 207 | + */ |
|
| 200 | 208 | public function getStub($stub) |
| 201 | 209 | { |
| 202 | 210 | return $this->filesystem->get($this->getPath($stub)); |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | public function generateFile($path, $stub, $namespace) |
| 172 | 172 | { |
| 173 | - if (! $this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
|
| 173 | + if (!$this->filesystem->exists($path) || $this->confirm($path.' already exists! Continue?')) { |
|
| 174 | 174 | $content = str_replace('$NAMESPACE$', $namespace, $stub); |
| 175 | 175 | |
| 176 | - if (! $this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 176 | + if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
|
| 177 | 177 | $this->filesystem->makeDirectory($dir, 0777, true, true); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $path = config('repository.generator.stubsOverridePath', $defaultPath); |
| 191 | 191 | |
| 192 | 192 | // rollback |
| 193 | - if (! file_exists($path.'/Stubs/base/'.$stub.'.stub')) { |
|
| 193 | + if (!file_exists($path.'/Stubs/base/'.$stub.'.stub')) { |
|
| 194 | 194 | $path = $defaultPath; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function validateCreate(array $attributes) |
| 36 | 36 | { |
| 37 | - if (! is_null($this->validator)) { |
|
| 37 | + if (!is_null($this->validator)) { |
|
| 38 | 38 | $this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_CREATE); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function validateUpdate(array $attributes) |
| 46 | 46 | { |
| 47 | - if (! is_null($this->validator)) { |
|
| 47 | + if (!is_null($this->validator)) { |
|
| 48 | 48 | $this->validator->with($attributes)->passesOrFail(ValidatorInterface::RULE_UPDATE); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | public function makeModel() |
| 94 | 94 | { |
| 95 | 95 | $model = $this->relateModel ? $this->relation() : $this->app->make($this->model()); |
| 96 | - if (! ($model instanceof Model || $model instanceof Relation)) { |
|
| 96 | + if (!($model instanceof Model || $model instanceof Relation)) { |
|
| 97 | 97 | throw new RepositoryException('Class '.get_class($model).' must be an instance of Illuminate\\Database\\Eloquent\\Model'); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $ip = smart_get_client_ip(); |
| 102 | 102 | |
| 103 | - if (! $this->isDirty(static::UPDATED_IP) && $this->hasTableColumn(static::UPDATED_IP)) { |
|
| 103 | + if (!$this->isDirty(static::UPDATED_IP) && $this->hasTableColumn(static::UPDATED_IP)) { |
|
| 104 | 104 | $this->{static::UPDATED_IP} = $ip; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if (! $this->exists && ! $this->isDirty(static::CREATED_IP) && $this->hasTableColumn(static::CREATED_IP)) { |
|
| 107 | + if (!$this->exists && !$this->isDirty(static::CREATED_IP) && $this->hasTableColumn(static::CREATED_IP)) { |
|
| 108 | 108 | $this->{static::CREATED_IP} = $ip; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | protected function updateUsers() |
| 128 | 128 | { |
| 129 | 129 | $user_id = $this->getAuthUserId(); |
| 130 | - if (! ($user_id > 0)) { |
|
| 130 | + if (!($user_id > 0)) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if (! $this->isDirty(static::UPDATED_BY) && $this->hasTableColumn(static::UPDATED_BY)) { |
|
| 134 | + if (!$this->isDirty(static::UPDATED_BY) && $this->hasTableColumn(static::UPDATED_BY)) { |
|
| 135 | 135 | $this->{static::UPDATED_BY} = $user_id; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if (! $this->exists && ! $this->isDirty(static::CREATED_BY) && $this->hasTableColumn(static::CREATED_BY)) { |
|
| 138 | + if (!$this->exists && !$this->isDirty(static::CREATED_BY) && $this->hasTableColumn(static::CREATED_BY)) { |
|
| 139 | 139 | $this->{static::CREATED_BY} = $user_id; |
| 140 | 140 | } |
| 141 | 141 | } |