📜  laravel where 关系条件 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:40.695000             🧑  作者: Mango

代码示例2
class Game extends Eloquent {
    // many more stuff here

    // relation without any constraints ...works fine 
    public function videos() {
        return $this->hasMany('Video');
    }

    // results in a "problem", se examples below
    public function available_videos() {
        return $this->videos()->where('available','=', 1)->get();
    }
}