使用Laravel Eloquent Join加入三个表

时间:2014-06-23 06:12:21

标签: php laravel laravel-4 eloquent

这是我的表结构

announcement_catagory

 `id`
 `company_id`
 `category_name`
 `employee_id`
 `created_date`

announcemet

`id`, 
`company_id`, 
`employee_id`, 
`category_id`,
`title`, 
`announcement`, 
allow_comment`,
announcement_date`,
view_count`,
status`

announcement_comment
    `id`,
    `company_id`, 
    `employee_id`,
    `category_id`,
    `title`,
    `announcement`,
    `allow_comment`,
    `announcement_date`,
    `view_count`,
    `status`

我的模特是

class Announcement extends BaseClientCompanyModel {

protected $table = "Announcement";

}

class AnnouncementCategory extends BaseClientCompanyModel {

        protected $table = "Announcement_Category";
}

class AnnouncementComment扩展了BaseClientCompanyModel {

protected $table = "announcement_comment";

}

我需要根据公司ID及其类别和评论数量获取公告,我不知道从哪里开始

0 个答案:

没有答案