feat: implement barangay system phases 2-14
Complete adaptation from BukidBountyApp to Philippine barangay governance: - Barangay models: Resident, Household, HouseholdMember, Blotter, BlotterHearing, DocumentRequest, RequestPayment, RequestType, BarangayProject, BarangayBudget - Controllers: ResidentController, HouseholdController, BlotterController, BlotterHearingController, DocumentRequestController, RequestTypeController, ProjectController, BudgetController, QRPHController, AdminConsoleController, UserController, FileController, ChapterController, LoginController - Vue pages: Home, ManageResidents, ResidentProfile, ManageHouseholds, ManageBlotters, BlotterDetail, RequestDocument, ManageDocumentRequests, DocumentRequestDetail, ManageRequestTypes, ManageProjects, BudgetLedger, AdminConsole - Barangay roles: PunongBarangay, Kagawad, Secretary, Treasurer, SK, Tanod, BHW, Staff, Resident - UserPermissions matrix rewritten with barangay-specific permission mappings - VueRouteMap replaced with barangay SPA routes - UserActions enum references corrected across all controllers - Removed all market/cooperative/POS/subscription code and models
This commit is contained in:
51
app/Models/Barangay/Household.php
Normal file
51
app/Models/Barangay/Household.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models\Barangay;
|
||||
|
||||
use App\Models\Model;
|
||||
use Hypervel\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Household extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected ?string $table = 'barangay_households';
|
||||
|
||||
protected array $fillable = [
|
||||
'hashkey', 'household_no', 'head_resident_id',
|
||||
'address', 'purok', 'barangay', 'city', 'province',
|
||||
'member_count', 'ownership_type', 'monthly_rental',
|
||||
'has_electricity', 'has_water', 'housing_material',
|
||||
'is_active', 'created_by', 'updated_by',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'monthly_rental' => 'decimal:2',
|
||||
'has_electricity' => 'boolean',
|
||||
'has_water' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
'member_count' => 'integer',
|
||||
];
|
||||
|
||||
public function head()
|
||||
{
|
||||
return $this->belongsTo(Resident::class, 'head_resident_id');
|
||||
}
|
||||
|
||||
public function members()
|
||||
{
|
||||
return $this->hasMany(HouseholdMember::class, 'household_id');
|
||||
}
|
||||
|
||||
public function activeMembers()
|
||||
{
|
||||
return $this->members()->where('is_active', true);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user