feat: companies CRUD with person dialog integration and navigation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,10 @@ final class CompanyController extends Controller
|
||||
{
|
||||
Gate::authorize('viewAny', [Company::class, $organisation]);
|
||||
|
||||
$companies = $organisation->companies()->get();
|
||||
$companies = $organisation->companies()
|
||||
->withCount('persons')
|
||||
->ordered()
|
||||
->get();
|
||||
|
||||
return CompanyResource::collection($companies);
|
||||
}
|
||||
@@ -34,6 +37,15 @@ final class CompanyController extends Controller
|
||||
return $this->created(new CompanyResource($company));
|
||||
}
|
||||
|
||||
public function show(Organisation $organisation, Company $company): JsonResponse
|
||||
{
|
||||
Gate::authorize('view', [$company, $organisation]);
|
||||
|
||||
$company->loadCount('persons');
|
||||
|
||||
return $this->success(new CompanyResource($company));
|
||||
}
|
||||
|
||||
public function update(UpdateCompanyRequest $request, Organisation $organisation, Company $company): JsonResponse
|
||||
{
|
||||
Gate::authorize('update', [$company, $organisation]);
|
||||
|
||||
Reference in New Issue
Block a user