A simple (straw) poll web application made with Laravel
https://poll.fuwafuwa.moe
No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
22 líneas
390 B
22 líneas
390 B
<?php |
|
|
|
namespace App; |
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
class PollOption extends Model |
|
{ |
|
public $timestamps = false; |
|
|
|
protected $fillable = ['text']; |
|
|
|
public function poll() |
|
{ |
|
return $this->belongsTo('App\Poll'); |
|
} |
|
|
|
public function getVoteCountAttribute() |
|
{ |
|
return $this->poll->votes->where('poll_option_id', $this->id)->count(); |
|
} |
|
}
|
|
|