public function testRelationshipWithBinUuid()
 {
     $firstUser = EloquentBinUserModel::create(['username' => 'first-user', 'password' => 'secret']);
     $secondUser = EloquentBinUserModel::create(['username' => 'second-user', 'password' => 'secret']);
     $postsForFirstUser = [];
     $postsForSecondUser = [];
     for ($i = 0; $i < 10; $i++) {
         $postsForFirstUser[] = new EloquentBinPostModel(['name' => 'First user - post ' . $i]);
         $postsForSecondUser[] = EloquentBinPostModel::create(['name' => 'Second user - post ' . $i, 'user_id' => $secondUser->id]);
     }
     $firstUser->posts()->saveMany($postsForFirstUser);
     $this->assertEquals(10, $firstUser->posts()->count());
     $this->assertEquals(10, $secondUser->posts()->count());
     $foundUser = EloquentBinUserModel::with('posts')->find($firstUser->id);
     $this->assertNotNull($foundUser);
     $this->assertEquals(10, count($foundUser->posts));
 }
 public function testManyToManyRelationshipsWithBin()
 {
     $firstUser = EloquentBinUserModel::create(['username' => 'first-user', 'password' => 'secret']);
     $secondUser = EloquentBinUserModel::create(['username' => 'second-user', 'password' => 'secret']);
     $thirdUser = EloquentBinUserModel::create(['username' => 'third-user', 'password' => 'secret']);
     $firstRole = EloquentBinRoleModel::create(['name' => 'Sailor']);
     $secondRole = EloquentBinRoleModel::create(['name' => 'Cook']);
     $thirdRole = EloquentBinRoleModel::create(['name' => 'Pirate']);
     $firstUser->roles()->attach([$firstRole->id, $secondRole->id]);
     $crusoe = EloquentBinUserModel::find($firstUser->id);
     $this->assertEquals(2, $crusoe->roles()->count());
     $secondUser->roles()->attach([$firstRole->id, $secondRole->id]);
     $secondUser->roles()->sync([$secondRole->id, $thirdRole->id]);
     $crusoe = EloquentBinUserModel::find($secondUser->id);
     $found = false;
     foreach ($crusoe->roles as $role) {
         if ($role->id === $thirdRole->id) {
             $found = true;
         }
     }
     $this->assertTrue($found);
 }