debugging

This commit is contained in:
2018-11-10 15:04:11 -06:00
parent 8dd50ce1e4
commit b65dfccd2d

View File

@@ -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,28 +48,21 @@ 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 {
dd($checks);
foreach($checks as $check) {
if($check->role == $role) {
return true;
}
}
return false; return false;
} }
}
public function getUserType() { public function getUserType() {
return User::where('user_type')->get(); return User::where('user_type')->get();
} }
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() {