pdf result

This commit is contained in:
nurafrinaalimi16
2024-04-29 16:56:53 +08:00
parent 2a7f91199e
commit eac65986a6
8 changed files with 577 additions and 7 deletions
+16
View File
@@ -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();
}
}