I have created a laravel api for my application.I have used Pingpong module package for different modules.I am having hard time establishing many-to-many relation.I have 3 tables:`roles,groups,group_roles`.And my models are:

Group.php

```php
namespace Modules\User\Entities;
use Illuminate\Database\Eloquent\Model;
class Group extends Model {
   protected $fillable = [];
   protected $table='groups';

   public static function roles(){
      return $this->belongsToMany('Modules\User\Entities\Role','group_roles','group_id','role_id');
   }
}

```

Role.php

```php
namespace Modules\User\Entities;
use Illuminate\Database\Eloquent\Model;
class Role extends Model {
   protected $fillable = [];
   protected $table='roles';
   public function groups(){
      return $this->belongsToMany('Modules\User\Entities\Group','group_roles','group_id','role_id');
   }
}

```

And my controller

```php
namespace Modules\User\Http\Controllers;
use Pingpong\Modules\Routing\Controller;
use Modules\User\Entities\Group;
use Modules\User\Entities\Role;

use Illuminate\Http\Request;
use App\Login;

use Input; 
use Validator;
use Hash;
use Response;

class UserController extends Controller {
   public function getGroupById(Request $request){
      $groups=Group::with('roles')->get();
      return Response::json ([
            'status'=>'ok',
            'group'=>$groups
      ],200);
   }   
}

```

The problem is I am not able to establish the relation between the models and the getGroupById returns 500 internal error response.`$group=Group::all(); $group=Group::find($request['id']);` returns fine but it is not returning related roles.

Similar structure and codes work fine on app without the use pingpong.