dongyi1996
2015-11-28 06:47
浏览 31
已采纳

Idiorm / Paris - 访问交汇处的列

I'm using Paris for my new project...

Let's say I have 3 tables: users, books and borrows:

users: id/name

books: id/title

borrows: users_id/books_id/borrow_date/return_date


In Books class:

function users()
{
    return $this->has_many_through('Users', 'Borrows');
}

In Users class:

function books()
{
    return $this->has_many_through('User', 'Borrows');
}

Everything is fine, I can access to borrowed books by each user and list of users who borrowed a single book before, but I'm wondering that how can I access to borrow_date and return_date column/property of Borrows table/class?

1条回答 默认 最新

相关推荐 更多相似问题