JWT implemented for customer api authorization

This commit is contained in:
jitendra 2019-04-09 16:27:33 +05:30
parent 7678593bd4
commit fb6ffaa9d9
9 changed files with 31 additions and 24 deletions

View File

@ -29,7 +29,8 @@
"maatwebsite/excel": "3.1.x-dev",
"nwidart/laravel-modules": "^3.2",
"prettus/l5-repository": "^2.6",
"propaganistas/laravel-intl": "^2.0"
"propaganistas/laravel-intl": "^2.0",
"tymon/jwt-auth": "dev-develop"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",

View File

@ -13,7 +13,7 @@ return [
],
'api' => [
'driver' => 'token',
'driver' => 'jwt',
'provider' => 'customers',
],

View File

@ -16,7 +16,7 @@ return [
'enabled' => env('DEBUGBAR_ENABLED', null),
'except' => [
'telescope*'
//
],
/*

View File

@ -2,21 +2,6 @@
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Alias Blacklist

View File

@ -54,7 +54,7 @@ return [
| $useTranslationFallback when defined
|
*/
'use_fallback' => true,
'use_fallback' => false,
/*
|--------------------------------------------------------------------------
@ -113,4 +113,4 @@ return [
|
*/
'to_array_always_loads_translations' => true,
];
];

View File

@ -4,13 +4,14 @@ namespace Webkul\Customer\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Webkul\Checkout\Models\CartProxy;
use Webkul\Sales\Models\OrderProxy;
use Webkul\Product\Models\ProductReviewProxy;
use Webkul\Customer\Notifications\CustomerResetPassword;
use Webkul\Customer\Contracts\Customer as CustomerContract;
class Customer extends Authenticatable implements CustomerContract
class Customer extends Authenticatable implements CustomerContract, JWTSubject
{
use Notifiable;
@ -103,4 +104,24 @@ class Customer extends Authenticatable implements CustomerContract
public function all_orders() {
return $this->hasMany(OrderProxy::modelClass(), 'customer_id');
}
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
}

View File

@ -21,7 +21,7 @@
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
@endcomponent
@endslot
@endcomponent

View File

@ -21,7 +21,7 @@
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
@endcomponent
@endslot
@endcomponent

View File

@ -56,7 +56,7 @@
'into your web browser: [:actionURL](:actionURL)',
[
'actionText' => $actionText,
'actionURL' => $actionUrl,
'actionURL' => $actionUrl
]
)
@endcomponent