diff --git a/src/Http/Controllers/OrganizationProfileController.php b/src/Http/Controllers/OrganizationProfileController.php index 81127787..4eaab494 100644 --- a/src/Http/Controllers/OrganizationProfileController.php +++ b/src/Http/Controllers/OrganizationProfileController.php @@ -30,26 +30,26 @@ public function store(StoreOrganizationProfileRequest $request, Organization $or return redirect()->route("organizations.edit", $organization); } - public function edit(Organization $organization, OrganizationProfile $profile): View + public function edit(Organization $organization, OrganizationProfile $organizationProfile): View { return view("organizations.profiles.edit") ->with([ "organization" => $organization, - "profile" => $profile, + "profile" => $organizationProfile, "availableProfiles" => AvailableProfiles::casesToSelect(), ]); } - public function update(UpdateOrganizationProfileRequest $request, Organization $organization, OrganizationProfile $profile): RedirectResponse + public function update(UpdateOrganizationProfileRequest $request, Organization $organization, OrganizationProfile $organizationProfile): RedirectResponse { - $profile->update($request->validated()); + $organizationProfile->update($request->validated()); return redirect()->route("organizations.edit", $organization); } - public function destroy(Organization $organization, OrganizationProfile $profile): RedirectResponse + public function destroy(Organization $organization, OrganizationProfile $organizationProfile): RedirectResponse { - $profile->delete(); + $organizationProfile->delete(); return back(); } diff --git a/src/Http/Routing/WebRouting.php b/src/Http/Routing/WebRouting.php index 2228f3a2..dfdf88fd 100755 --- a/src/Http/Routing/WebRouting.php +++ b/src/Http/Routing/WebRouting.php @@ -93,9 +93,9 @@ public function wire(): void $this->router->controller(OrganizationProfileController::class)->group(function (): void { $this->router->get("/organizations/{organization}/profiles/create", "create")->name("organizations.profiles.create"); $this->router->post("/organizations/{organization}/profiles", "store")->name("organizations.profiles.store"); - $this->router->get("/organizations/{organization}/profiles/{profile}/edit", "edit")->name("organizations.profiles.edit"); - $this->router->put("/organizations/{organization}/profiles/{profile}", "update")->name("organizations.profiles.update"); - $this->router->delete("/organizations/{organization}/profiles/{profile}", "destroy")->name("organizations.profiles.destroy"); + $this->router->get("/organizations/{organization}/profiles/{organizationProfile}/edit", "edit")->name("organizations.profiles.edit")->scopeBindings(); + $this->router->put("/organizations/{organization}/profiles/{organizationProfile}", "update")->name("organizations.profiles.update")->scopeBindings(); + $this->router->delete("/organizations/{organization}/profiles/{organizationProfile}", "destroy")->name("organizations.profiles.destroy")->scopeBindings(); }); $this->router->controller(SpeakersController::class)->group(function (): void { diff --git a/tests/Feature/Organizations/Profiles/OrganizationProfilesRequestTest.php b/tests/Feature/Organizations/Profiles/OrganizationProfilesRequestTest.php index 3746906f..b8e58b88 100644 --- a/tests/Feature/Organizations/Profiles/OrganizationProfilesRequestTest.php +++ b/tests/Feature/Organizations/Profiles/OrganizationProfilesRequestTest.php @@ -30,22 +30,17 @@ public function testOrganizationProfileRequestHasRelatedOrganization(): void $organization = Organization::factory()->create(); $foreignOrganization = Organization::factory()->create(); - $organizationProfile = OrganizationProfile::factory() + OrganizationProfile::factory() ->for($organization) ->create(); - $this->actingAs($this->admin) - ->get(route("organizations.profiles.create", [$foreignOrganization, $organizationProfile])) - ->assertNotFound(); + $this->assertDatabaseCount("organization_profiles", 1); + $organizationProfile = OrganizationProfile::query()->first(); $this->actingAs($this->admin) ->get(route("organizations.profiles.edit", [$foreignOrganization, $organizationProfile])) ->assertNotFound(); - $this->actingAs($this->admin) - ->post(route("organizations.profiles.store", [$foreignOrganization, $organizationProfile])) - ->assertNotFound(); - $this->actingAs($this->admin) ->put(route("organizations.profiles.update", [$foreignOrganization, $organizationProfile])) ->assertNotFound();