updates
This commit is contained in:
13
app/models/Comment.php
Normal file
13
app/models/Comment.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Comment extends Eloquent {
|
||||
protected $table = "comments";
|
||||
|
||||
public function autor() {
|
||||
return $this->belongsTo('User', 'user');
|
||||
}
|
||||
|
||||
public function film() {
|
||||
return $this->belongsTo('Film', 'film');
|
||||
}
|
||||
}
|
||||
5
app/models/Event.php
Normal file
5
app/models/Event.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Event extends Eloquent {
|
||||
protected $table = "events";
|
||||
}
|
||||
26
app/models/Film.php
Normal file
26
app/models/Film.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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')->take(5);
|
||||
}
|
||||
|
||||
public function scopeNeuesteVorschlage($query) {
|
||||
return $query->whereNull('gesehen')->orderBy('updated_at')->take(5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,4 +49,16 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
|
||||
public function films() {
|
||||
return $this->hasMany('Film', 'user');
|
||||
}
|
||||
|
||||
public function comments() {
|
||||
return $this->hasMany('Comment', 'user');
|
||||
}
|
||||
|
||||
public function votes() {
|
||||
return $this->hasMany('Vote', 'user');
|
||||
}
|
||||
}
|
||||
13
app/models/Vote.php
Normal file
13
app/models/Vote.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Vote extends Eloquent {
|
||||
protected $table = "votes";
|
||||
|
||||
public function film() {
|
||||
return $this->belongsTo('Film', 'film');
|
||||
}
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo('User', 'user');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user