You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added full backend and frontend support for associating API tokens with companies, including creation, validation (via external API), and deletion.
Introduced new API endpoints and Eloquent model for company API tokens, with migration, factory, and seeder scaffolding.
Created Vue components for managing and deleting company API tokens, and integrated them into the company admin edit page.
Added composables for API token mutations and updated backend services to support dynamic API key validation.
Enhanced model documentation with PHPDoc annotations for improved IDE support.
Minor bug fixes in existing company form component and improved eager loading of relationships.
This PR introduces a robust system for managing API tokens at the company level, including validation against an external service, UI for admins to add or remove tokens, and all necessary backend infrastructure. It also improves code documentation and fixes minor issues in related components.
Changes walkthrough
Relevant files
Enhancement
19 files
CompanyApiTokenController.php
Add CompanyApiToken API controller with CRUD endpoints and validation
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Sensitive information exposure: The new API endpoint index() in CompanyApiTokenController returns all API tokens without authentication or filtering, which could leak sensitive tokens to unauthorized users.
⚡ Recommended areas for review
Undefined Variable isDeleting is referenced in the template but never defined. The button disable state should use the mutation's loading state (e.g., isLoading) or map it correctly.
Mutation Error Handling The onError callback is provided at the top level of the hook options instead of inside the config object, so errors may not be caught. It should be nested under config alongside onSuccess.
Default-value Binding Using default-value on the Input only sets the initial value and will not update when the token changes. Use :value binding to keep the display in sync.
Excessive Logging A console.log inside the watch callback logs the entire company object on every change, which may expose sensitive data and clutter the console. Consider removing or restricting it.
Data Exposure The index() method returns all company API tokens without filtering by company or enforcing authorization, potentially exposing sensitive tokens.
Repository Bloat An auto-generated IDE helper file with 20k+ lines has been committed, significantly bloating the repository. It should be excluded via .gitignore or removed.
Missing Import The Company model defines an apiToken relation using CompanyApiToken but the class is not imported, leading to a potential class not found error.
Invalid Migration The migration calls $table->uuid() without a column name, which is invalid. It should specify a column name, e.g. $table->uuid('uuid');.
Missing Validation StoreCompanyApiTokenRequest has empty rules(), so payload keys like company_id and api_token are not validated, risking data integrity issues.
Console Log Leftover A console.log statement remains in production code, which could leak sensitive data and clutter logs.
Header Key Inconsistency The header uses camelCase apiKey, which may not be recognized by the API. Ensure it matches the expected header name (e.g. Api-Key).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CodeAnt-AI Description
This PR introduces a robust system for managing API tokens at the company level, including validation against an external service, UI for admins to add or remove tokens, and all necessary backend infrastructure. It also improves code documentation and fixes minor issues in related components.
Changes walkthrough
19 files
CompanyApiTokenController.php
Add CompanyApiToken API controller with CRUD endpoints and validationapp/Http/Controllers/Api/CompanyApiTokenController.php
tokens.
CompanyApiToken.php
Add CompanyApiToken Eloquent model with relationships and docsapp/Models/CompanyApiToken.php
CompanyApiToken.Company.2025_06_17_152243_create_company_api_tokens_table.php
Add migration for company_api_tokens tabledatabase/migrations/2025_06_17_152243_create_company_api_tokens_table.php
company_api_tokenstable.flag.
CompanyAuthForm.vue
Add CompanyAuthForm Vue component for API token managementresources/js/components/feature/company/CompanyAuthForm.vue
CompanyApiTokenDeleteDialog.vue
Add CompanyApiTokenDeleteDialog Vue component for token deletionresources/js/components/feature/company/CompanyApiTokenDeleteDialog.vue
useCompanyApiTokenMutation.js
Add mutation composable for creating company API tokensresources/js/composables/mutations/company/useCompanyApiTokenMutation.js
useCompanyApiTokenDestroyMutation.js
Add mutation composable for deleting company API tokensresources/js/composables/mutations/company/useCompanyApiTokenDestroyMutation.js
index.js
Export API token mutation composables in company mutations indexresources/js/composables/mutations/company/index.js
PipelineApiAccessorialsList.php
Add PipelineApiAccessorialsList service for API token validationapp/Services/Pipeline/PipelineApiAccessorialsList.php
PipelineApiBaseService.php
Allow API key override in PipelineApiBaseService constructorapp/Services/Pipeline/PipelineApiBaseService.php
UpdateCompanyApiTokenRequest.php
Add UpdateCompanyApiTokenRequest for API token validationapp/Http/Requests/UpdateCompanyApiTokenRequest.php
api_tokenfield as a string.StoreCompanyApiTokenRequest.php
Add StoreCompanyApiTokenRequest placeholderapp/Http/Requests/StoreCompanyApiTokenRequest.php
CompanyApiTokenFactory.php
Add factory for CompanyApiToken modeldatabase/factories/CompanyApiTokenFactory.php
CompanyApiTokenSeeder.php
Add seeder for CompanyApiTokendatabase/seeders/CompanyApiTokenSeeder.php
Company.php
Add apiToken relationship and docs to Company modelapp/Models/Company.php
apiTokenrelationship to Company model.CompanyController.php
Eager load apiToken in CompanyController show methodapp/Http/Controllers/Api/CompanyController.php
apiTokenrelationship.api.php
Register companyApiTokens API resource routesroutes/api.php
Edit.vue
Integrate CompanyAuthForm into company admin edit pageresources/js/pages/admin/company/Edit.vue
web.php
Eager load apiToken in company web routeroutes/web.php
apiTokenrelationship when showing a company in webroutes.
6 files
User.php
Add PHPDoc annotations to User modelapp/Models/User.php
Image.php
Add PHPDoc annotations to Image modelapp/Models/Image.php
Theme.php
Add PHPDoc annotations to Theme modelapp/Models/Theme.php
BackgroundImage.php
Add PHPDoc annotations to BackgroundImage modelapp/Models/BackgroundImage.php
methods.
ImageType.php
Add PHPDoc annotations to ImageType modelapp/Models/ImageType.php
Log.php
Add PHPDoc annotations to Log modelapp/Models/Log.php
1 files
CompanyForm.vue
Minor fixes in CompanyForm componentresources/js/components/feature/company/CompanyForm.vue
awaitfrom toast calls.💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.