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:
44
app/Models/Barangay/BarangayProject.php
Normal file
44
app/Models/Barangay/BarangayProject.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models\Barangay;
|
||||
|
||||
use App\Models\Model;
|
||||
use Hypervel\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class BarangayProject extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected ?string $table = 'barangay_projects';
|
||||
|
||||
protected array $fillable = [
|
||||
'hashkey', 'project_name', 'description', 'type', 'budget',
|
||||
'fund_source', 'start_date', 'end_date', 'status',
|
||||
'implementing_office', 'contractor', 'location',
|
||||
'beneficiaries_count', 'created_by', 'updated_by',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'budget' => 'decimal:2',
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'beneficiaries_count' => 'integer',
|
||||
];
|
||||
|
||||
public function createdBy()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->whereNotIn('status', ['CANCELLED', 'COMPLETED']);
|
||||
}
|
||||
|
||||
public function scopeByType($query, string $type)
|
||||
{
|
||||
return $query->where('type', $type);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user