Skip to content

Conversation

@binaryk
Copy link
Collaborator

@binaryk binaryk commented May 19, 2020

Added

  • Detach repository
  • Detach multiple repositories
 $users = $this->mockUsers(3);
        $company = factory(Company::class)->create();
        $company->users()->attach($users->pluck('id'));

        $usersFromCompany = $this->getJson('/restify-api/users?viaRepository=companies&viaRepositoryId=1&viaRelationship=users');
        $this->assertCount(3, $usersFromCompany->json('data'));

        $this->postJson('restify-api/companies/' . $company->id . '/detach/users', [
            'users' => [1, 2]
        ])
            ->assertStatus(204);

        $usersFromCompany = $this->getJson('/restify-api/users?viaRepository=companies&viaRepositoryId=1&viaRelationship=users');
        $this->assertCount(1, $usersFromCompany->json('data'));

@binaryk binaryk merged commit 5bf9fea into 3.x May 19, 2020
@binaryk binaryk deleted the related-repositories branch May 19, 2020 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants