companies()->get(); return CompanyResource::collection($companies); } public function store(StoreCompanyRequest $request, Organisation $organisation): JsonResponse { Gate::authorize('create', [Company::class, $organisation]); $company = $organisation->companies()->create($request->validated()); return $this->created(new CompanyResource($company)); } public function update(UpdateCompanyRequest $request, Organisation $organisation, Company $company): JsonResponse { Gate::authorize('update', [$company, $organisation]); $company->update($request->validated()); return $this->success(new CompanyResource($company->fresh())); } public function destroy(Organisation $organisation, Company $company): JsonResponse { Gate::authorize('delete', [$company, $organisation]); $company->delete(); return response()->json(null, 204); } }