black-bits / laravel-cognito-auth

MIT License
89 stars 51 forks source link

Remove the routes, views and translations and set it as an option in the setup, or make a vendor publishing #42

Open phackwer opened 3 years ago

phackwer commented 3 years ago

Because the Service Provider defines this:

// $this->loadRoutesFrom(DIR.'/routes.php'); // $this->loadViewsFrom(DIR.'/Resources/views', 'black-bits/laravel-cognito-auth'); // $this->loadTranslationsFrom(DIR.'/Resources/lang', 'black-bits/laravel-cognito-auth');

I had no longer could run php artisan route:list without having a fatal error:

root@3adc9221d37d:/var/www/html# php artisan route:list

Illuminate\Contracts\Container\BindingResolutionException : Target class [App\Http\Controllers\Auth\VerificationController] does not exist.

at /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:805 801| 802| try { 803| $reflector = new ReflectionClass($concrete); 804| } catch (ReflectionException $e) {

805| throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); 806| } 807| 808| // If the type is not instantiable, the developer is attempting to resolve 809| // an abstract type such as an Interface or Abstract Class and there is

Exception trace:

1 Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console{closure}()

2 ReflectionException::("Class App\Http\Controllers\Auth\VerificationController does not exist")

bartmcleod commented 3 years ago

I can not reproduce this. Can list routes with the command. Version: "black-bits/laravel-cognito-auth": "dev-defaultProvider"

From


    {
        "type": "vcs",
        "url": "https://github.com/jaytaph/laravel-cognito-auth"
    }
MarcosSchlickmann commented 3 years ago

I have this same issue on a fresh start. Perhaps it's because I'm on Laravel 8?

MarcosSchlickmann commented 3 years ago

It is because of the version. I agree with @phackwer, these routes should be optional or customizable.

In Laravel 8 the authentication scaffolding was changed. I generated it through laravel/breeze and these are the generated files in app/Http/Controllers/Auth:

AuthenticatedSessionController.php
ConfirmablePasswordController.php
EmailVerificationNotificationController.php
EmailVerificationPromptController.php
NewPasswordController.php
PasswordResetLinkController.php
RegisteredUserController.php
VerifyEmailController.php

In Laravel 6 these are the files scaffolded by laravel/ui in app/Http/Controllers/Auth:

ConfirmPasswordController.php
ForgotPasswordController.php
LoginController.php
RegisterController.php
ResetPasswordController.php
VerificationController.php
phackwer commented 3 years ago

@MarcosSchlickmann I've made a fork to comment the routes from the service provider of the package till someone answer this request.

https://github.com/4cme/laravel-cognito-auth

In my case we have an app so the laravel is all API oriented, no views there other than the jsons. I think that it the best approach in this case would be to isolate screens/views and routes as an isolated package that uses the core of the package to talk to cognito.

phackwer commented 3 years ago

BTW: the forked package also fixes the error I had on 104.