(Update) Cleanup Voter Model

This commit is contained in:
HDVinnie
2018-06-06 19:51:07 -04:00
parent edd9bf518d
commit 3dd770ce25
+17 -3
View File
@@ -16,21 +16,35 @@ use Illuminate\Database\Eloquent\Model;
class Voter extends Model
{
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'poll_id',
'user_id',
'ip_address'
];
/**
* Belongs To A Poll
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function poll()
{
return $this->belongsTo(\App\Poll::class);
return $this->belongsTo(Poll::class);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);