diff --git a/app/Course/Controllers/CourseController.php b/app/Course/Controllers/CourseController.php index c6a510df..547dc9fb 100644 --- a/app/Course/Controllers/CourseController.php +++ b/app/Course/Controllers/CourseController.php @@ -17,20 +17,20 @@ class CourseController extends Controller { $request->persist($member); - return redirect()->route('member.index'); + return redirect()->back(); } public function update(Member $member, CourseMember $course, UpdateRequest $request): RedirectResponse { $request->persist($member, $course); - return redirect()->route('member.index'); + return redirect()->back(); } public function destroy(Member $member, CourseMember $course, DestroyRequest $request): RedirectResponse { $request->persist($member, $course); - return redirect()->route('member.index'); + return redirect()->back(); } } diff --git a/app/Course/Resources/CourseResource.php b/app/Course/Resources/CourseResource.php index 8cf309fa..24c571d8 100644 --- a/app/Course/Resources/CourseResource.php +++ b/app/Course/Resources/CourseResource.php @@ -17,11 +17,12 @@ class CourseResource extends JsonResource { return [ 'id' => $this->id, - 'organizer' => $this->pivot->organizer, - 'event_name' => $this->pivot->event_name, - 'completed_at_human' => Carbon::parse($this->pivot->completed_at)->format('d.m.Y'), - 'completed_at' => $this->pivot->completed_at, - 'course_name' => $this->name, + 'organizer' => $this->organizer, + 'event_name' => $this->event_name, + 'completed_at_human' => Carbon::parse($this->completed_at)->format('d.m.Y'), + 'completed_at' => $this->completed_at, + 'course_name' => $this->course->name, + 'course_id' => $this->course->id, ]; } } diff --git a/app/Initialize/InitializeController.php b/app/Initialize/InitializeController.php index a57cfd25..ad5a46a1 100644 --- a/app/Initialize/InitializeController.php +++ b/app/Initialize/InitializeController.php @@ -2,8 +2,8 @@ namespace App\Initialize; -use Illuminate\Http\Request; use App\Http\Controllers\Controller; +use Illuminate\Http\Request; class InitializeController extends Controller { @@ -14,6 +14,6 @@ class InitializeController extends Controller public function store() { InitializeJob::dispatch(auth()->user()); - return \Inertia::render('Initialize/Index'); + return redirect()->route('home'); } } diff --git a/packages/laravel-nami b/packages/laravel-nami index d348aea5..d96457dd 160000 --- a/packages/laravel-nami +++ b/packages/laravel-nami @@ -1 +1 @@ -Subproject commit d348aea5f6bba6cf3eb8e2050a738817f281b4c3 +Subproject commit d96457dd338857306b6ffb14da5444b8cf08417a diff --git a/resources/js/views/member/Courses.vue b/resources/js/views/member/Courses.vue index 69a66c31..28a59020 100644 --- a/resources/js/views/member/Courses.vue +++ b/resources/js/views/member/Courses.vue @@ -3,9 +3,10 @@
- - - + + + +
@@ -47,6 +48,7 @@ export default { }, props: { + courses: {}, value: {} }, @@ -54,11 +56,7 @@ export default { methods: { remove(payment) { - this.$inertia.delete(`/member/${this.value.id}/payment/${payment.id}`); - }, - - accept(payment) { - this.$inertia.patch(`/member/${this.value.id}/payment/${payment.id}`, { ...payment, status_id: 3 }); + this.$inertia.delete(`/member/${this.value.id}/course/${payment.id}`); }, openLink(link) { @@ -73,23 +71,17 @@ export default { var _self = this; this.mode === 'create' - ? this.$inertia.post(`/member/${this.value.id}/payment`, this.single, { + ? this.$inertia.post(`/member/${this.value.id}/course`, this.single, { onFinish() { _self.single = null; } }) - : this.$inertia.patch(`/member/${this.value.id}/payment/${this.single.id}`, this.single, { + : this.$inertia.patch(`/member/${this.value.id}/course/${this.single.id}`, this.single, { onFinish() { _self.single = null; } }); } - }, - - props: { - value: {}, - subscriptions: {}, - statuses: {}, } }; diff --git a/tests/Feature/Member/IndexTest.php b/tests/Feature/Member/IndexTest.php index 870777ed..4de7492d 100644 --- a/tests/Feature/Member/IndexTest.php +++ b/tests/Feature/Member/IndexTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature\Member; +use App\Course\Models\Course; +use App\Course\Models\CourseMember; use App\Member\Member; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; @@ -16,7 +18,7 @@ class IndexTest extends TestCase $this->withoutExceptionHandling(); $this->login(); - Member::factory()->defaults()->create(['firstname' => '::firstname']); + Member::factory()->defaults()->has(CourseMember::factory()->for(Course::factory()), 'courses')->create(['firstname' => '::firstname']); $this->get('/member')->assertInertia('member/Index', ['firstname' => '::firstname'], 'data.data.0'); }