How make relation

I have two tables Courses and Batches

Courses fields are

id(PK)

course_name

code

section_name

is_deleted

created_at

updated_at

Batches Field are

id(PK)

name

course_id(FK)

start_date

end_date

is_active

is_deleted

employee_id

How I can make relations in both the models

Can any one help me…

if you are talking about AR models, this will help you.

Hi,

you learn much more if you try to do it yourself cause it is a really easy task.

The Working with Databases: Relational Active Record topic in the guide should help you out.

Look at the relation between tbl_user and tbl_post tables, it’s like in your example.

If you don’t be able to do it ask again and I or somebody else will help you but first try it yourself