Initial integration with Quicken (Intuit API), rework oauth tables, update/test google login
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\NextKey;
|
||||
|
||||
class AccountOauth extends Model
|
||||
{
|
||||
use NextKey;
|
||||
const RECORD_ID = 'account_oauth';
|
||||
public $incrementing = FALSE;
|
||||
|
||||
protected $table = 'ab_account_oauth';
|
||||
const CREATED_AT = 'date_orig';
|
||||
const UPDATED_AT = 'date_last';
|
||||
public $dateFormat = 'U';
|
||||
|
||||
protected $casts = [
|
||||
'oauth_data'=>'array',
|
||||
];
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo(Account::class);
|
||||
}
|
||||
|
||||
public function site()
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
}
|
||||
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a link token to use when validating account.
|
||||
*/
|
||||
public function getLinkTokenAttribute(): string
|
||||
{
|
||||
return strtoupper(substr(md5($this->id.$this->date_last),0,8));
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\NextKey;
|
||||
|
||||
class Oauth extends Model
|
||||
{
|
||||
use NextKey;
|
||||
const RECORD_ID = 'oauth';
|
||||
public $incrementing = FALSE;
|
||||
|
||||
protected $table = 'ab_oauth';
|
||||
public $timestamps = FALSE;
|
||||
|
||||
protected $fillable = ['name','active'];
|
||||
|
||||
public function accounts()
|
||||
{
|
||||
return $this->hasMany(AccountOauth::class);
|
||||
}
|
||||
}
|
24
app/Models/ProviderOauth.php
Normal file
24
app/Models/ProviderOauth.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProviderOauth extends Model
|
||||
{
|
||||
protected $table = 'provider_oauth';
|
||||
|
||||
protected $fillable = ['name','active'];
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function tokens()
|
||||
{
|
||||
return $this->hasMany(ProviderToken::class);
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(UserOauth::class);
|
||||
}
|
||||
}
|
17
app/Models/ProviderToken.php
Normal file
17
app/Models/ProviderToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\SiteID;
|
||||
|
||||
class ProviderToken extends Model
|
||||
{
|
||||
use SiteID;
|
||||
|
||||
protected $dates = [
|
||||
'access_token_expires_at',
|
||||
'refresh_token_expires_at',
|
||||
];
|
||||
}
|
31
app/Models/UserOauth.php
Normal file
31
app/Models/UserOauth.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\SiteID;
|
||||
|
||||
class UserOauth extends Model
|
||||
{
|
||||
use SiteID;
|
||||
|
||||
protected $table = 'user_oauth';
|
||||
|
||||
protected $casts = [
|
||||
'oauth_data'=>'json',
|
||||
];
|
||||
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a link token to use when validating account.
|
||||
*/
|
||||
public function getLinkTokenAttribute(): string
|
||||
{
|
||||
return strtoupper(substr(md5($this->id.$this->date_last),0,8));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user