+Bewertungen, Meistgewünschter Film, Sortierung nach Votes
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Event extends Eloquent {
|
||||
protected $table = "events";
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class Film extends Eloquent {
|
||||
}
|
||||
|
||||
public function scopeNeuesteVorschlage($query) {
|
||||
return $query->whereNull('gesehen')->orderBy('updated_at')->take(5);
|
||||
return $query->whereNull('gesehen')->orderBy('updated_at', 'DESC')->take(5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
14
app/models/News.php
Normal file
14
app/models/News.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class News extends Eloquent {
|
||||
protected $table = "news";
|
||||
|
||||
public function ersteller() {
|
||||
return $this->belongsTo('User', 'author');
|
||||
}
|
||||
|
||||
public function scopeAktuell($query) {
|
||||
return $query->orderBy('updated_at', 'DESC')->take(5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,4 +63,8 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
|
||||
public function votes() {
|
||||
return $this->hasMany('Vote', 'user');
|
||||
}
|
||||
|
||||
public function news() {
|
||||
return $this->hasMany('News', 'author');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user