Added oauth login
This commit is contained in:
47
app/Models/AccountOauth.php
Normal file
47
app/Models/AccountOauth.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\User;
|
||||
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()
|
||||
{
|
||||
return strtoupper(substr(md5($this->id.$this->date_last),0,8));
|
||||
}
|
||||
}
|
25
app/Models/Oauth.php
Normal file
25
app/Models/Oauth.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\User;
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user