A simple (straw) poll web application made with Laravel
https://poll.fuwafuwa.moe
25'ten fazla konu seçemezsiniz
Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
22 satır
390 B
22 satır
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(); |
|
} |
|
}
|
|
|