pdf result
This commit is contained in:
@@ -3,9 +3,25 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Result extends Model
|
||||
{
|
||||
protected $table = 'result';
|
||||
protected $fillable = ['voter_id', 'nominee_id', 'position_id', 'election_id'];
|
||||
// protected $appends = ['votes'];
|
||||
|
||||
|
||||
|
||||
function nominee() : BelongsTo {
|
||||
return $this->belongsTo(Nominee::class);
|
||||
}
|
||||
|
||||
public function votes($nominee_id)
|
||||
{
|
||||
return $this->where('nominee_id','=',$nominee_id)->count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user