Skip to content

Laravel authentication for your Nylo project! Login, Register, Forgot Password and more

License

Notifications You must be signed in to change notification settings

nylo-core/laravel-auth-slate

Repository files navigation

Laravel Authentication Slate

Scaffolds an authentication UI in your Nylo project.

Getting Started

In your Flutter project add the dependency:

With Dart:

dart pub add laravel_auth_slate

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  ...
  laravel_auth_slate: ^1.2.0

Usage

Step 1: Run the below command in your project.

dart run laravel_auth_slate:main publish:all

With Nylo

metro publish:slate laravel_auth_slate

Step 2: Go to config/events.dart and update the following event:

// from
SyncAuthToBackpackEvent: SyncAuthToBackpackEvent<User>(),

// to 
SyncAuthToBackpackEvent: SyncAuthToBackpackEvent<LaravelAuthResponse>(),

Routes

The initial route should be AuthLandingPage.

Go to your routes/router.dart file and update the following:

appRouter() => nyRoutes((router) {
 ...
 router.route(AuthLandingPage.path, (context) => AuthLandingPage(), initialRoute: true); // set to initial route
 
});

Update your .env file

In your Nylo project, navigate to your .env file and update the following line:

APP_URL="https://nylo.dev" // old url

APP_URL="http:https://examplelaravel.test" // your laravel project url

Laravel project

Install the Laravel composer package laravel-nylo-auth.

You can install the package via composer:

composer require nylo/laravel-nylo-auth

You can publish with:

php artisan vendor:publish --provider="Nylo\LaravelNyloAuth\LaravelNyloAuthServiceProvider"

Now, build and run the app and try to login, register and use the forgotten password page.

Check out the Laravel package here for more information.

Requirements

  • Dart >= 2.19.0
  • Flutter >= 3.10.0

Files generated:

  • Pages
    • LoginPage
    • RegisterPage
    • LandingPage
    • DashboardPage
    • AuthLandingPage
  • Controllers
    • LoginController
    • RegisterController
    • ForgotPasswordController
  • Events
    • LaravelAuthEvent
  • Networking
    • LaravelApiService
    • LaravelAuthService
  • Models
    • AuthUser
    • AuthResponse

Changelog

Please see CHANGELOG for more information what has changed recently.

Licence

The MIT License (MIT). Please view the License File for more information.