A simple (straw) poll web application made with Laravel
https://poll.fuwafuwa.moe
Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
22 wiersze
390 B
22 wiersze
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(); |
|
} |
|
}
|
|
|