You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Models/Poll.php

36 lines
589 B
PHTML

4 years ago
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\HasSnowflakePrimary;
4 years ago
class Poll extends Model
{
use HasSnowflakePrimary, HasFactory;
4 years ago
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
protected $casts = [
'poll_options' => 'array',
'cached_tallies' => 'array',
'expires_at' => 'datetime'
];
4 years ago
public function votes()
{
return $this->hasMany(PollVote::class);
}
4 years ago
public function getTallies()
{
return $this->cached_tallies;
}
4 years ago
}