Skip to content
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

Open
augustinewafula opened this issue Sep 6, 2019 · 23 comments
Open

Laravel 6 support #147

augustinewafula opened this issue Sep 6, 2019 · 23 comments

Comments

@augustinewafula
Copy link

No description provided.

@rajtri
Copy link

rajtri commented Sep 14, 2019

its not working with laravel 6.0

@Manishchudasama
Copy link

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
Manish

@Manishchudasama
Copy link

getServiceInput())); } /** * Get the name of the lucid service passed as argument. * * @return string */ protected function getServiceInput() { return trim($this->argument('service')); } }

@Manishchudasama
Copy link

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; } }

@Manishchudasama
Copy link

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'], ]; } }

@Manishchudasama
Copy link

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; } }

@Manishchudasama
Copy link

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; } }

@ajay-ag
Copy link

ajay-ag commented Oct 8, 2019

  1. ) Create a new Helper Directory inside app folder and create a helpers.php file and put all this function
    https://github.com/ajay-ag/blog/commit/e32425323e1722fc01158c0e09925b80cb010cfd
    Note : only string relented function

2.) put this code in service provider

foreach (glob(app_path().'/Helpers/*.php') as $filename){
require_once($filename);
}

@limminho
Copy link

For string related issues: run composer require laravel/helpers.
https://laravel.com/docs/6.x/upgrade#helpers

alaminfirdows added a commit to alaminfirdows/hesto-multi-auth that referenced this issue Oct 12, 2019
@alaminfirdows
Copy link

alaminfirdows commented Oct 12, 2019

The current package isn't compatible with laravel 6.
I've replaced all the string functions by Str Helper.

You may check my repo: alaminfirdows/laravel-multi-auth

@kmunirawi
Copy link

The current package isn't compatible with laravel 6.
I've replaced all the string functions by Str Helper.

You may check my repo: alaminfirdows/multi-auth

How to use the package with ur modifications?

@alaminfirdows
Copy link

alaminfirdows commented Oct 15, 2019

Updated...

You may like this package, works on Laravel 6.*
alaminfirdows/laravel-multi-auth


I didn't create any package yet.
Just download/clone my repo and paste it on your vendor folder.

@ajay-ag
Copy link

ajay-ag commented Oct 15, 2019

i did not change in package file , i have create separate file put the necessary functions

@kmunirawi
Copy link

I didn't create any package yet.
Just download/clone my repo and paste it on your vendor folder.

Hello. Hesto/multi-auth can't be downloaded with Laravel 6.

  1. How can I download it on Laravel 6?
  2. How can I download ur modifications?
    Regards

@alaminfirdows
Copy link

alaminfirdows commented Oct 15, 2019

Hello. Hesto/multi-auth can't be downloaded with Laravel 6.

  1. How can I download it on Laravel 6?
  2. How can I download ur modifications?
    Regards

Updated...

You may like this package, works on Laravel 6.*
alaminfirdows/laravel-multi-auth


Step 1: Install Through Composer
composer require hesto/multi-auth

Step 2: Download my modification from alaminfirdows/multi-auth

Step 3: Go to vendor folder of your project and past the files.

Thanks.

@ajay-ag
Copy link

ajay-ag commented Oct 17, 2019

I think you can try this
All str_ and array_ helpers have been moved to the new laravel/helpers Composer package and removed from the framework. If desired, you may update all calls to these helpers to use the Illuminate\Support\Str and Illuminate\Support\Arr classes. Alternatively, you can add the new laravel/helpers package to your application to continue using these helpers:
composer require laravel/helpers

Then install hesto

@kmunirawi
Copy link

I think you can try this
All str_ and array_ helpers have been moved to the new laravel/helpers Composer package and removed from the framework. If desired, you may update all calls to these helpers to use the Illuminate\Support\Str and Illuminate\Support\Arr classes. Alternatively, you can add the new laravel/helpers package to your application to continue using these helpers:
composer require laravel/helpers

Then install hesto

I'll try it if the previous way didnt work. Thanks

@kmunirawi
Copy link

Hello. Hesto/multi-auth can't be downloaded with Laravel 6.

  1. How can I download it on Laravel 6?
  2. How can I download ur modifications?
    Regards

Step 1: Install Through Composer
composer require hesto/multi-auth

Step 2: Download my modification from alaminfirdows/multi-auth

Step 3: Go to vendor folder of your project and past the files.

Thanks.

hesto-files

Copy files to which folder? plz
Is there a direct way to send u some details with u, email for example?
Regards

@alaminfirdows
Copy link

Updated...

Dear all,
You may like this package, works on Laravel 6.*
alaminfirdows/laravel-multi-auth

@ajay-ag
Copy link

ajay-ag commented Oct 24, 2019 via email

@alaminfirdows
Copy link

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.

@ajay-ag
Copy link

ajay-ag commented Oct 25, 2019 via email

@mtvbrianking
Copy link

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

image

You might wanna try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants