Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Premio extends Model
- {
- protected $fillable = ['id', 'nombre', 'descripcion', 'status', 'picture'];
- public function puntos()
- {
- return $this->ultimosPuntos->first()->puntos;
- }
- public function ultimosPuntos()
- {
- // Obtengo los últimos 10 puntos
- return $this->hasMany(PuntosPremio::class)
- ->skip(0)
- ->take(10)
- ->orderBy('created_at', 'desc');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement