Change local database with external api

Viewed 12

I have a local database which should be changed by an external api; I need to plugin somehow this api in existing models and use it in existing auth system, built with passport;

Current code :

class User extends Authenticatable implements MustVerifyEmail, MustFillDetails
{

    use Notifiable, HasSanctumTokens;

    protected $fillable = [
       'email',
       'password',
       'tos_agreed',
    ];
    ...........

auth.php

'guards' => [
'web' => [
  'driver'   => 'session',
  'provider' => 'users',
],

'api' => [
  'driver'   => 'token',
  'provider' => 'users',
  'hash'     => false,
],

'api3' => [
  'driver'   => 'passport',
  'provider' => 'users',
  'hash'     => false,
],
...
'providers' => [
'users' => [
  'driver' => 'eloquent',
  'model'  => App\Models\User::class,
],
.......

And I have the endpoint : http://test.com/users;

There is a was to change this model, and consume data from this external api and not from local database ? And the same question for passport, will be able to use it with this external api ?

Thx in advance

0 Answers
Related