1234567891011121314151617181920212223242526 |
- <?php
- class Film extends Eloquent {
- protected $table = "films";
- public function comments() {
- return $this->hasMany('Comment', 'film');
- }
- public function votes() {
- return $this->hasMany('Vote', 'film');
- }
- public function besitzer() {
- return $this->belongsTo('User', 'user');
- }
- public function scopeZuletztGesehen($query) {
- return $query->whereNotNull('gesehen')->orderBy('gesehen', 'DESC')->take(5);
- }
- public function scopeNeuesteVorschlage($query) {
- return $query->whereNull('gesehen')->orderBy('updated_at', 'DESC')->take(5);
- }
- }
|