From 5399ddccac1676a0e48d9d1c14a5c772952daebd Mon Sep 17 00:00:00 2001 From: Lupacescu Eduard Date: Tue, 9 Jun 2020 20:49:50 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Http/Controllers/RepositoryAttachController.php | 4 ++-- tests/Controllers/RepositoryAttachInterceptorTest.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Http/Controllers/RepositoryAttachController.php b/src/Http/Controllers/RepositoryAttachController.php index b16301941..c25a5eefa 100644 --- a/src/Http/Controllers/RepositoryAttachController.php +++ b/src/Http/Controllers/RepositoryAttachController.php @@ -23,7 +23,7 @@ public function __invoke(RepositoryAttachRequest $request) return $repository->attach( $request, $request->repositoryId, collect(Arr::wrap($request->input($request->relatedRepository))) - ->map(fn($relatedRepositoryId) => $this->initializePivot( + ->map(fn ($relatedRepositoryId) => $this->initializePivot( $request, $model->{$request->viaRelationship ?? $request->relatedRepository}(), $relatedRepositoryId )) ); @@ -76,7 +76,7 @@ public function guessMethodName(RestifyRequest $request, Repository $repository) return $cb; } - $methodGuesser = "attach" . Str::studly($request->relatedRepository); + $methodGuesser = 'attach'.Str::studly($request->relatedRepository); if (method_exists($repository, $methodGuesser)) { return [$repository, $methodGuesser]; diff --git a/tests/Controllers/RepositoryAttachInterceptorTest.php b/tests/Controllers/RepositoryAttachInterceptorTest.php index 1ccd3382e..55c2dc590 100644 --- a/tests/Controllers/RepositoryAttachInterceptorTest.php +++ b/tests/Controllers/RepositoryAttachInterceptorTest.php @@ -12,12 +12,11 @@ public function test_can_intercept_attach_method() $role = factory(Role::class)->create(); $user = $this->mockUsers()->first(); - $this->postJson('restify-api/roles/' . $role->id . '/attach/users', [ + $this->postJson('restify-api/roles/'.$role->id.'/attach/users', [ 'users' => $user->id, ]) ->assertCreated(); $this->assertDatabaseCount('model_has_roles', 1); - } }