From 6d08b6a1b6f18696b0f338e11c03fc80489932d3 Mon Sep 17 00:00:00 2001 From: AmonDeShir Date: Thu, 8 Aug 2024 14:02:05 +0200 Subject: [PATCH] change Auth::user to request->user --- app/Http/Controllers/OrganizationController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/OrganizationController.php b/app/Http/Controllers/OrganizationController.php index 58fa9ff2..3b657548 100644 --- a/app/Http/Controllers/OrganizationController.php +++ b/app/Http/Controllers/OrganizationController.php @@ -7,6 +7,7 @@ use App\Http\Resources\OrganizationResource; use App\Jobs\FetchRepositoriesJob; use App\Models\Organization; +use App\Models\User; use App\Services\AssignUserToOrganizationsService; use Carbon\Carbon; use Illuminate\Bus\Batch; @@ -38,7 +39,7 @@ public function show(Request $request) return Inertia::render("Organization", ["data" => $data, "progress" => $status]); } - public function fetchData(int $organizationId): JsonResponse + public function fetchData(int $organizationId, Request $request): JsonResponse { $organization = Organization::query()->findOrFail($organizationId); $batch = $this->findBatch($organizationId); @@ -47,7 +48,8 @@ public function fetchData(int $organizationId): JsonResponse return response()->json(["message" => "please wait"], Response::HTTP_CONFLICT); } - $jobs = [new FetchRepositoriesJob($organizationId, Auth::user()->id)]; + $user = $request->user(); + $jobs = [new FetchRepositoriesJob($organizationId, $user->id)]; $organization->fetch_at = Carbon::now(); $organization->save();