-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel 6 support #147
Comments
its not working with laravel 6.0 |
a Few amendments helped me work out php artisan commands, not sure if that will help. use Illuminate\Support\Str; and change str_<> to Str::<>, Str:snake. I am still testing if that works. almost all the Traits has this bug for laravel 6.01 release. see if this helps.... Regards |
getServiceInput())); } /** * Get the name of the lucid service passed as argument. * * @return string */ protected function getServiceInput() { return trim($this->argument('service')); } } |
replaceNames($content); return $content; } /** * Get info message output * * @param $filePath * @return mixed */ protected function getInfoMessage($filePath) { return $this->info('Content changed in: ' . $filePath); } /** * Get the desired class name from the input. * * @return string */ protected function getParsedNameInput() { return mb_strtolower(Str::singular($this->getNameInput())); } /** * Get the desired class name from the input. * * @return string */ protected function getNameInput() { return trim($this->argument('name')); } /** * Get the console command arguments. * * @return array */ public function getArguments() { return [ ['name', InputArgument::REQUIRED, 'The name of the class'], ]; } /** * Check if stub's content exists in given file (path) * * @param $path * @param $stub * @return bool */ public function contentExists($path, $stub) { $originalContent = $this->files->get($path); $content = $this->replaceNames($this->files->get($stub)); if (Str::contains(trim($originalContent), trim($content))) { return true; } return false; } } |
option('lucid') && !$this->getParsedServiceInput()) { $this->error('You must pass a Service name with the `--lucid` option.'); return true; } if ($this->option('force')) { $name = $this->getParsedNameInput(); $domain = $this->option('domain'); $lucid = $this->option('lucid'); $service = $this->getParsedServiceInput() ?: null; Artisan::call('multi-auth:settings', [ 'name' => $name, 'service' => $service, '--domain' => $domain, '--lucid' => $lucid, '--force' => true ]); Artisan::call('multi-auth:files', [ 'name' => $name, 'service' => $service, '--domain' => $domain, '--lucid' => $lucid, '--force' => true ]); if (!$this->option('model')) { Artisan::call('multi-auth:model', [ 'name' => $name, '--lucid' => $lucid, '--force' => true ]); $this->installMigration(); $this->installPasswordResetMigration(); } if (!$this->option('views')) { Artisan::call('multi-auth:views', [ 'name' => $name, 'service' => $service, '--lucid' => $lucid, '--force' => true ]); } if (!$this->option('routes')) { $this->installWebRoutes(); } $this->info('Multi Auth with ' . ucfirst($name) . ' guard successfully installed.'); return true; } $this->info('Use `-f` flag first.'); return true; } /** * Install Web Routes. * * @return bool */ public function installWebRoutes() { $lucid = $this->option('lucid'); $domain = $this->option('domain'); $service = $this->getParsedServiceInput(); if ($lucid) { $stub = !$domain ? __DIR__ . '/../stubs/Lucid/routes/web.stub' : __DIR__ . '/../stubs/Lucid/domain-routes/web.stub'; $lucidPath = base_path() . '/src/Services/' . studly_case($service) . '/Http/routes.php'; $lucidStub = !$domain ? __DIR__ . '/../stubs/Lucid/routes/map-method.stub' : __DIR__ . '/../stubs/Lucid/domain-routes/map-method.stub'; if (!$this->contentExists($lucidPath, $lucidStub)) { $lucidFile = new SplFileInfo($lucidStub); $this->appendFile($lucidPath, $lucidFile); } if (!$this->contentExists($lucidPath, $stub)) { $file = new SplFileInfo($stub); $this->appendFile($lucidPath, $file); return true; } return false; } $path = base_path() . '/routes/web.php'; $stub = __DIR__ . '/../stubs/routes/web.stub'; if ($domain) { $stub = __DIR__ . '/../stubs/domain-routes/web.stub'; } if (!$this->contentExists($path, $stub)) { $file = new SplFileInfo($stub); $this->appendFile($path, $file); return true; } return false; } /** * Install Migration. * * @return bool */ public function installMigration() { $name = $this->getParsedNameInput(); $migrationDir = base_path() . '/database/migrations/'; $migrationName = 'create_' . Str::plural(STR::snake($name)) . '_table.php'; $migrationStub = new SplFileInfo(__DIR__ . '/../stubs/Model/migration.stub'); $files = $this->files->allFiles($migrationDir); foreach ($files as $file) { if (Str::contains($file->getFilename(), $migrationName)) { $this->putFile($file->getPathname(), $migrationStub); return true; } } $path = $migrationDir . date('Y_m_d_His') . '_' . $migrationName; $this->putFile($path, $migrationStub); return true; } /** * Install PasswordResetMigration. * * @return bool */ public function installPasswordResetMigration() { $name = $this->getParsedNameInput(); $migrationDir = base_path() . '/database/migrations/'; $migrationName = 'create_' . STR::singular(STR::snake($name)) . '_password_resets_table.php'; $migrationStub = new SplFileInfo(__DIR__ . '/../stubs/Model/PasswordResetMigration.stub'); $files = $this->files->allFiles($migrationDir); foreach ($files as $file) { if (STR::contains($file->getFilename(), $migrationName)) { $this->putFile($file->getPathname(), $migrationStub); return true; } } $path = $migrationDir . date('Y_m_d_His', strtotime('+1 second')) . '_' . $migrationName; $this->putFile($path, $migrationStub); return true; } /** * Get the console command options. * * @return array */ public function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Force override existing files'], ['domain', false, InputOption::VALUE_NONE, 'Install in a subdomain'], ['lucid', false, InputOption::VALUE_NONE, 'Lucid architecture'], ['model', null, InputOption::VALUE_NONE, 'Exclude model and migration'], ['views', null, InputOption::VALUE_NONE, 'Exclude views'], ['routes', null, InputOption::VALUE_NONE, 'Exclude routes'], ]; } } |
getSettings(); foreach ($settings as $setting) { $path = $setting['path']; $fullPath = base_path() . $path; if ($this->putContent($fullPath, $this->compileContent($fullPath, $setting))) { $this->getInfoMessage($fullPath); } } return true; } /** * Compile content. * * @param $path * @param $setting * @return mixed */ protected function compileContent($path, $setting) //It should be compile method instead { $originalContent = $this->files->get($path); $content = $this->replaceNames($this->files->get($setting['stub'])); if (!Str::contains(trim($originalContent), trim($content))) { if ($setting['prefix']) { $stub = $content . $setting['search']; } else { $stub = $setting['search'] . $content; } $originalContent = str_replace($setting['search'], $stub, $originalContent); } return $originalContent; } } |
getNameInput())); } /** * Get the desired class name from the input. * * @return string */ protected function getNameInput() { return trim($this->argument('name')); } /** * Replace names with pattern. * * @param $template * @return $this */ public function replaceNames($template) { $name = $this->getParsedNameInput(); $service = $this->getParsedServiceInput(); $name = str::plural($name); $plural = [ '{{pluralCamel}}', '{{pluralSlug}}', '{{pluralSnake}}', '{{pluralClass}}', ]; $singular = [ '{{singularCamel}}', '{{singularSlug}}', '{{singularSnake}}', '{{singularClass}}', '{{singularServiceCamel}}', '{{singularServiceSlug}}', '{{singularServiceSnake}}', '{{singularServiceClass}}', ]; $replacePlural = [ Str::camel($name), Str::slug($name), Str::snake($name), ucfirst(Str::camel($name)), ]; $replaceSingular = [ Str::singular(Str::camel($name)), Str::singular(Str::slug($name)), Str::singular(Str::snake($name)), Str::singular(ucfirst(Str::camel($name))), Str::camel($service), Str::slug($service), Str::snake($service), ucfirst(Str::camel($service)), ]; $template = str_replace($plural, $replacePlural, $template); $template = str_replace($singular, $replaceSingular, $template); $template = str_replace('{{Class}}', ucfirst(Str::camel($name)), $template); return $template; } } |
2.) put this code in service provider
|
For string related issues: run |
The current package isn't compatible with laravel 6. You may check my repo: alaminfirdows/laravel-multi-auth |
How to use the package with ur modifications? |
Updated... You may like this package, works on Laravel 6.* I didn't create any package yet. |
i did not change in package file , i have create separate file put the necessary functions |
Hello. Hesto/multi-auth can't be downloaded with Laravel 6.
|
Updated... You may like this package, works on Laravel 6.* Step 1: Install Through Composer Step 2: Download my modification from alaminfirdows/multi-auth Step 3: Go to vendor folder of your project and past the files. Thanks. |
I think you can try this Then install hesto |
I'll try it if the previous way didnt work. Thanks |
Copy files to which folder? plz |
Updated... Dear all, |
What was the actual actual problem
…On Thu, 24 Oct, 2019, 2:03 PM Al-Amin Firdows, ***@***.***> wrote:
*Updated...*
Dear all,
You may like this package
<https://github.com/alaminfirdows/laravel-multi-auth>, works on Laravel
6.*
alaminfirdows/laravel-multi-auth
<https://github.com/alaminfirdows/laravel-multi-auth>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#147?email_source=notifications&email_token=AKO74MHQWEQA6LGJDGSEPODQQFMWLA5CNFSM4IUMOTMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECEGGHI#issuecomment-545809181>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKO74MHEUPBKCS4Q3IO55LLQQFMWLANCNFSM4IUMOTMA>
.
|
The actual problem was string functions not exist on Laravel 6, I replaced it by Str Helper. |
I have already mentioned step by step in comments
…On Thu, 24 Oct, 2019, 11:39 PM Al-Amin Firdows, ***@***.***> wrote:
The actual problem was string functions not exist on Laravel 6, I replaced
it by Str Helper.
On my package, customized folders, and namespaces also.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#147?email_source=notifications&email_token=AKO74MGKOJZPLJFQU6OSNBLQQHQGLA5CNFSM4IUMOTMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECF53CY#issuecomment-546037131>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKO74MBJGUHBL2CIHERYRZDQQHQGLANCNFSM4IUMOTMA>
.
|
This is no fix for this particular package. But I have a similar multi-auth package that supports Laravel versions 5.3 to 6.x https://github.com/mtvbrianking/multi-auth You might wanna try it. |
No description provided.
The text was updated successfully, but these errors were encountered: