| @@ 128-146 (lines=19) @@ | ||
| 125 | * |
|
| 126 | * @return string |
|
| 127 | */ |
|
| 128 | protected function parseObserver($observer) |
|
| 129 | { |
|
| 130 | if (preg_match('([^A-Za-z0-9_/\\\\])', $observer)) { |
|
| 131 | throw new InvalidArgumentException('Observer name contains invalid characters.'); |
|
| 132 | } |
|
| 133 | ||
| 134 | $observer = trim(str_replace('/', '\\', $observer), '\\'); |
|
| 135 | ||
| 136 | if (!Str::startsWith( |
|
| 137 | $observer, |
|
| 138 | $rootNamespace = $this->laravel->getNamespace() |
|
| 139 | )) { |
|
| 140 | $observer = $rootNamespace . $this->getComponentNamespace() |
|
| 141 | . '\Observers\\' |
|
| 142 | . $observer; |
|
| 143 | } |
|
| 144 | ||
| 145 | return $observer; |
|
| 146 | } |
|
| 147 | ||
| 148 | protected function buildModelReplacements(array $replace) |
|
| 149 | { |
|
| @@ 179-192 (lines=14) @@ | ||
| 176 | * |
|
| 177 | * @return string |
|
| 178 | */ |
|
| 179 | protected function parseModel($model) |
|
| 180 | { |
|
| 181 | if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { |
|
| 182 | throw new InvalidArgumentException('Model name contains invalid characters.'); |
|
| 183 | } |
|
| 184 | ||
| 185 | $model = trim(str_replace('/', '\\', $model), '\\'); |
|
| 186 | ||
| 187 | if (!Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) { |
|
| 188 | $model = $rootNamespace . $model; |
|
| 189 | } |
|
| 190 | ||
| 191 | return $model; |
|
| 192 | } |
|
| 193 | ||
| 194 | protected function getViewColumns($model) |
|
| 195 | { |
|