tests
This commit is contained in:
@@ -39,7 +39,7 @@ class TestController extends Controller
|
||||
$perms = new Collection;
|
||||
|
||||
|
||||
var_dump(auth()->user()->userAlts());
|
||||
var_dump(auth()->user()->getAlts());
|
||||
dd(auth()->user()->altCount());
|
||||
|
||||
//Get all of the users in the database
|
||||
@@ -49,9 +49,9 @@ class TestController extends Controller
|
||||
//in this first part
|
||||
foreach($users as $char) {
|
||||
$altCount = $char->altCount();
|
||||
dd($altCount);
|
||||
|
||||
if($altCount > 0) {
|
||||
$alts = $char->userAlts;
|
||||
$alts = $char->getAlts();
|
||||
|
||||
foreach($alts as $alt) {
|
||||
$perms->push([
|
||||
|
||||
@@ -63,12 +63,12 @@ class User extends Authenticatable
|
||||
return $this->hasMany('App\Models\User\UserAlt', 'character_id', 'main_id');
|
||||
}
|
||||
|
||||
public function getUserAlts() {
|
||||
return $this->hasMany('App\Models\User\UserAlt', 'character_id', 'main_id')->get();
|
||||
public function altCount() {
|
||||
return UserAlt::where(['main_id' => $this->character_id])->count();
|
||||
}
|
||||
|
||||
public function altCount() {
|
||||
return $this->hasMany('App\Models\User\UserAlt', 'character_id', 'main_id')->count();
|
||||
public function getAlts() {
|
||||
return UserAlt::where(['main_id' => $this->character_id])->get();
|
||||
}
|
||||
|
||||
public function hasPermission($permission) {
|
||||
|
||||
@@ -32,6 +32,10 @@ class UserAlt extends Model
|
||||
];
|
||||
|
||||
public function mainCharacter() {
|
||||
return $this->belongsTo('App\Models\User\User', 'character_id');
|
||||
return $this->belongsTo('App\Models\User\User', 'character_id', 'main_id');
|
||||
}
|
||||
|
||||
public function getMain() {
|
||||
return User::where(['character_id' => $this->main_id])->get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user