Download the PHP package askedio/laravel-multiauth without Composer
On this page you can find all versions of the php package askedio/laravel-multiauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-multiauth
Laravel Multi Auth
Authenticate your Laravel 5 applications with email/password, email link, socialite and custom drivers. Demo & Example app.
This package extends the default auth system with a custom guard, views and routes.
Installation
Install with composer.
composer require askedio/laravel-multiauth
Enable
Edit config/app.php
Register the provider
and alias
Askedio\MultiAuth\MultiAuthServiceProvider::class,
'MultiAuth' => Askedio\MultiAuth\Facades\MultiAuth::class,
Publish & migrate
Please note: The users
table needs some new fields & a table for the tokens.
php artisan vendor:publish
php artisan migrate
Laravel Auth
Make the Laravel auth system.
php artisan make:auth
Configure Routes
Edit app/Http/routes.php
Add the following line.
MultiAuth::route();
Configure User Model
Edit app\User.php
Change fillable to read.
protected $fillable = [
'name', 'email', 'password', 'avatar', 'nickname', 'confirmed',
];
Add the oauth relation.
public function oauth()
{
return $this->hasMany(\Askedio\MultiAuth\Models\UserOauth::class);
}
Configure Auth Guards & Providers
Edit config/auth.php
Add to the guards
array
'multiAuth' => [
'driver' => 'session',
'provider' => 'multiAuth',
],
Add to the providers
array
'multiAuth' => [
'driver' => 'multiAuth',
'model' => App\User::class,
],
Configure your template
Edit resources/views/auth/login.blade.php
Replace content with the multiauth::login
login form.
@extends('layouts.app')
@section('content')
@include('multiauth::login')
@endsection
Configure Socialite
Edit config/services.php
Add all the services you want.
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('APP_URL').'/auth/facebook/callback',
],
Edit .env
and add all the settings.
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=