48 lines
1010 B
PHP
48 lines
1010 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class AccomodationModel extends Model
|
|
{
|
|
protected $table = 'c_accomodation';
|
|
protected $primaryKey = 'accomodation_id';
|
|
|
|
protected $allowedFields = [
|
|
'plan_id',
|
|
'destination_city',
|
|
'hotel_name',
|
|
'class',
|
|
'checkin_date',
|
|
'checkin_time',
|
|
'checkout_date',
|
|
'checkout_time',
|
|
'comments',
|
|
'is_this_exceptional',
|
|
'created_by',
|
|
'updated_by',
|
|
'is_active'
|
|
];
|
|
|
|
protected $useTimestamps = false;
|
|
protected $createdField = 'created_on';
|
|
protected $updatedField = 'updated_on';
|
|
|
|
/**
|
|
* Get active accommodations
|
|
*/
|
|
public function getActiveAccommodations()
|
|
{
|
|
return $this->where('is_active', 1)->findAll();
|
|
}
|
|
|
|
/**
|
|
* Get accommodations for a specific plan
|
|
*/
|
|
public function getAccommodationsByPlan($planId)
|
|
{
|
|
return $this->where('plan_id', $planId)->findAll();
|
|
}
|
|
}
|