Support the ongoing development of Laravel.io →
posted 8 years ago
Database

Hello! Please advice me how to connect two tables within database - Company and Employees.

First, you create a Company profile and it create row in table - companies.

Secondly, you upload the employee.csv to the table - employees.

In employees table there is company_id which should be linked to the company's id in companies table, how to make it automatic?

For example, previously I set relations manually by the

$post->category_id = $request->input('category_id');

however, now I have no idea how to solve this.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.