I have 2 tables
Album
id |isactive| name
Gallery
id |album_id| is_cover
One Album
may have multiple Gallery
I need to pull the cover photo of each album which is active
class Gallery extends \Eloquent {
public function Album() {
return $this->belongsTo('Album')->where("is_active","=","Y");
}
// Add your validation rules here
public static $rules = []
// Don't forget to fill this array
protected $fillable = []
}
my ORM is as below
Gallery::with('Album')->where('is_cover','=','Y')
Since i have already appended is_active='Y'
on model but still it is showing all albums(i mean inactive albums are also showing)