AuthServiceProvider.php
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace App\Providers;
use App\Modules\Models\Order\ConsumeOrder;
use Carbon\Carbon;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\JWTGuard;
/**
* Class AuthServiceProvider.
*/
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
//
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
Auth::extend('sms', function($app, $name, array $config) {
// Return an instance of Illuminate\Contracts\Auth\Guard...
return new JWTGuard($app['tymon.jwt'],
new CustomerUserProvider(config('auth.customer_model')),
$app['request']);
});
Auth::extend('sms2', function($app, $name, array $config) {
// Return an instance of Illuminate\Contracts\Auth\Guard...
return new JWTGuard($app['tymon.jwt'],
new BusinessUserProvider(config('auth.business_model')),
$app['request']);
});
}
}