A simple (straw) poll web application made with Laravel https://poll.fuwafuwa.moe
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

22 rindas
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();
}
}