4 months ago

Custom Pivot Table not being respected?

Posted 4 months ago by JohnnyW2001

I'm not sure what I've done wrong, but whenever I try to get a model's attributes from a pivot table, Laravel is looking in the wrong place.

Person model:

  protected $connection = 'second';
  protected $table = 'people';

  public function permissionTypes() {
      return $this->belongsToMany('App\PermissionType')->using('App\PersonPermission');

PermissionType model:

protected $connection = 'second';

public function people() {
    return $this->belongsToMany('App\Person')->using('App\PersonPermission');

PeoplePermission model:

class PersonPermission extends Pivot
    protected $connection = "second";
    protected $table = "people_permissions";

And yet in Tinker:


Error: Table 'second.permission_type_person' doesn't exist

Why is it looking for permission_type_person? :(

Please sign in or create an account to participate in this conversation.