LaravelPackages.net
Acme Inc.
Toggle sidebar
nlocascio/mindbody-laravel-auth

MINDBODY Auth Wrapper for Laravel

10
2
v0.4.0
About nlocascio/mindbody-laravel-auth

nlocascio/mindbody-laravel-auth is a Laravel package for mindbody auth wrapper for laravel. It currently has 2 GitHub stars and 10 downloads on Packagist (latest version v0.4.0). Install it with composer require nlocascio/mindbody-laravel-auth. Discover more Laravel packages by nlocascio or browse all Laravel packages to compare alternatives.

Last updated

Laravel MINDBODY Auth

This package is a Laravel User Provider which authenticates user logins through MINDBODY. It exposes two auth drivers: one for authenticating Client credentials, and one for authenticating Staff credentials.

Requirements

This package requires:

  • PHP 7.0+
  • Laravel 5.1+
  • Nlocascio/Mindbody-Laravel 0.2.0+

Installation

Install the package through Composer:

composer require nlocascio/mindbody-laravel-auth

This package requires nlocascio/mindbody-laravel to communicate with the MINDBODY API. You must configure that package first before proceeding.

Laravel

Register the Service Provider

In config/app.php, append to the providers key before App\Providers\AuthServiceProvider::class is declared:

Nlocascio\MindbodyAuth\MindbodyAuthServiceProvider::class

Configure the User Provider

In your app's config/auth.php, add the following to the providers key:

For authenticating Clients with MINDBODY:
'mindbody_clients' => [
    'driver' => 'mindbody_client',
    'model' => App\User::class
],
For authenticating Staff with MINDBODY:
'mindbody_staff' => [
    'driver' => 'mindbody_staff',
    'model' => App\User::class
]

Note that your model can point to any Eloquent model which implements Illuminate\Contracts\Auth\Authenticatable. Depending on the needs of your application, you may prefer to have different models for different types of users; however, using the default App/User.php will work for many cases.

Configure the Authentication Guards

In your app's config/auth.php, add the following to the guards key:

For MINDBODY Client credentials:
'mindbody_client' => [
    'driver' => 'session',
    'provider' => 'mindbody_client'
],
or for MINDBODY Staff credentials:
'mindbody_staff' => [
    'driver' => 'session',
    'provider' => 'mindbody_staff'
]

Use the Guards in your Middleware

Now that you've registered and configured the guards, you may use them in your application by using the auth:mindbody_client or auth:mindbody_staff middleware.

You can set one of these guards to be the default authentication guard in config/auth.php under the defaults key:

'defaults' => [
    'guard'     => 'mindbody_client',      // or 'mindbody_staff'
    'passwords' => 'users',
],

Star History Chart