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

39 lines
723 B
PHTML

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