| @@ 99-112 (lines=14) @@ | ||
| 96 | * |
|
| 97 | * @return string |
|
| 98 | */ |
|
| 99 | protected function parseClass($class) |
|
| 100 | { |
|
| 101 | if (preg_match('([^A-Za-z0-9_/\\\\])', $class)) { |
|
| 102 | throw new InvalidArgumentException('Class name contains invalid characters.'); |
|
| 103 | } |
|
| 104 | ||
| 105 | $class = trim(str_replace('/', '\\', $class), '\\'); |
|
| 106 | ||
| 107 | if (!Str::startsWith($class, $rootNamespace = $this->laravel->getNamespace())) { |
|
| 108 | $class = $rootNamespace . $class; |
|
| 109 | } |
|
| 110 | ||
| 111 | return $class; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Get the stub file for the generator. |
|
| @@ 203-216 (lines=14) @@ | ||
| 200 | * |
|
| 201 | * @return string |
|
| 202 | */ |
|
| 203 | protected function parseModel($model) |
|
| 204 | { |
|
| 205 | if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { |
|
| 206 | throw new InvalidArgumentException('Model name contains invalid characters.'); |
|
| 207 | } |
|
| 208 | ||
| 209 | $model = trim(str_replace('/', '\\', $model), '\\'); |
|
| 210 | ||
| 211 | if (!Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) { |
|
| 212 | $model = $rootNamespace . $model; |
|
| 213 | } |
|
| 214 | ||
| 215 | return $model; |
|
| 216 | } |
|
| 217 | ||
| 218 | protected function getViewColumns($model) |
|
| 219 | { |
|