According to your tables, a user can belong to multiple companies.
If a user is attached to multiple companies, you cannot choose which company_id to send to the front, you must send all the companies ids to which the connected use is attached.
Then I would rather have these table fields instead of yours.
users
- id
- name
companies
- id
- name
company_user
user_id
company_id
And you can retrieve the companies ids like this.
$companiesIds = auth()->user()->companies->pluck('id')->toArray();
But if it's a mistake and each use is attached only to one company, it's different. Then the tables should be like these.
users
- id
- name
- company_id
companies
- id
- name
And then you can retrieve the company id when you need just via the connected user (no need to add it to the payload).
auth()->user()->company_id