public function preparePrefixes()
{
$this->prefixes['route'] = explode('/', config('infyom.laravel_generator.prefixes.route', ''));
$this->prefixes['path'] = explode('/', config('infyom.laravel_generator.prefixes.path', ''));
$this->prefixes['view'] = explode('.', config('infyom.laravel_generator.prefixes.view', ''));
$this->prefixes['public'] = explode('/', config('infyom.laravel_generator.prefixes.public', ''));
if ($this->getOption('prefix')) {
$multiplePrefixes = explode(',', $this->getOption('prefix'));
$this->prefixes['route'] = array_merge($this->prefixes['route'], $multiplePrefixes);
$this->prefixes['path'] = array_merge($this->prefixes['path'], $multiplePrefixes);
$this->prefixes['view'] = array_merge($this->prefixes['view'], $multiplePrefixes);
$this->prefixes['public'] = array_merge($this->prefixes['public'], $multiplePrefixes);
}
$this->prefixes['route'] = array_diff($this->prefixes['route'], ['']);
$this->prefixes['path'] = array_diff($this->prefixes['path'], ['']);
$this->prefixes['view'] = array_diff($this->prefixes['view'], ['']);
$this->prefixes['public'] = array_diff($this->prefixes['public'], ['']);
$routePrefix = '';
foreach ($this->prefixes['route'] as $singlePrefix) {
$routePrefix .= Str::camel($singlePrefix) . '.';
}
if (!empty($routePrefix)) {
$routePrefix = substr($routePrefix, 0, strlen($routePrefix) - 1);
}
$this->prefixes['route'] = $routePrefix;
$nsPrefix = '';
foreach ($this->prefixes['path'] as $singlePrefix) {
$nsPrefix .= Str::title($singlePrefix) . '\\';
}
if (!empty($nsPrefix)) {
$nsPrefix = substr($nsPrefix, 0, strlen($nsPrefix) - 1);
}
$this->prefixes['ns'] = $nsPrefix;
$pathPrefix = '';
foreach ($this->prefixes['path'] as $singlePrefix) {
$pathPrefix .= Str::title($singlePrefix) . '/';
}
if (!empty($pathPrefix)) {
$pathPrefix = substr($pathPrefix, 0, strlen($pathPrefix) - 1);
}
$this->prefixes['path'] = $pathPrefix;
$viewPrefix = '';
foreach ($this->prefixes['view'] as $singlePrefix) {
$viewPrefix .= Str::camel($singlePrefix) . '/';
}
if (!empty($viewPrefix)) {
$viewPrefix = substr($viewPrefix, 0, strlen($viewPrefix) - 1);
}
$this->prefixes['view'] = $viewPrefix;
$publicPrefix = '';
foreach ($this->prefixes['public'] as $singlePrefix) {
$publicPrefix .= Str::camel($singlePrefix) . '/';
}
if (!empty($publicPrefix)) {
$publicPrefix = substr($publicPrefix, 0, strlen($publicPrefix) - 1);
}
$this->prefixes['public'] = $publicPrefix;
}