debugging
This commit is contained in:
21
app/User.php
21
app/User.php
@@ -5,8 +5,8 @@ namespace App;
|
|||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use DB;
|
|
||||||
use Auth;
|
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
@@ -48,20 +48,13 @@ class User extends Authenticatable
|
|||||||
//Used in middleware to make sure a user is able to access many of the pages
|
//Used in middleware to make sure a user is able to access many of the pages
|
||||||
public function hasRole($role)
|
public function hasRole($role)
|
||||||
{
|
{
|
||||||
//Get the roles from the user_roles table
|
$check = User::roles()->get();
|
||||||
$check = DB::table('user_roles')->where(['character_id' => auth()->user()->character_id])->get();
|
dd($check);
|
||||||
dd($check['role']);
|
|
||||||
if($check['role'] == $role) {
|
if($check['role'] == $role) {
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
dd($checks);
|
|
||||||
foreach($checks as $check) {
|
|
||||||
if($check->role == $role) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserType() {
|
public function getUserType() {
|
||||||
@@ -69,7 +62,7 @@ class User extends Authenticatable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function roles() {
|
public function roles() {
|
||||||
return $this->hasMany('App\Models\UserRole', 'character_id', 'character_id');
|
return $this->hasOne('App\Models\UserRole', 'character_id', 'character_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function esitoken() {
|
public function esitoken() {
|
||||||
|
|||||||
Reference in New Issue
Block a user