<?php namespace App\Models;

use DB;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;
use Spatie\Permission\Traits\HasRoles;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

class Permission2 extends Permission
{
	public function getroles()
	{
	    $liste_roles="";
		$permission_roles =  DB::table('role_has_permissions')->where('permission_id', '=', $this->id)->get();

		foreach ($permission_roles as $permission_role)
		{
			$role=Role::find($permission_role->role_id);
		    $liste_roles .=(($liste_roles=="")?"":"<br/>").($role->name);
		} 
	    return $liste_roles;
	 }

}
