Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Premio extends Model
  2. {
  3. protected $fillable = ['id', 'nombre', 'descripcion', 'status', 'picture'];
  4.  
  5. public function puntos()
  6. {
  7. return $this->ultimosPuntos->first()->puntos;
  8. }
  9.  
  10. public function ultimosPuntos()
  11. {
  12. // Obtengo los últimos 10 puntos
  13. return $this->hasMany(PuntosPremio::class)
  14. ->skip(0)
  15. ->take(10)
  16. ->orderBy('created_at', 'desc');
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement