37 lines
888 B
PHP
37 lines
888 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class MemberApprovalRequestModel extends Model
|
|
{
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_APPROVED = 'approved';
|
|
public const STATUS_REJECTED = 'rejected';
|
|
|
|
protected $table = 'member_approval_request';
|
|
protected $primaryKey = 'mar_idx';
|
|
protected $returnType = 'object';
|
|
protected $useTimestamps = false;
|
|
protected $allowedFields = [
|
|
'mb_idx',
|
|
'mar_requested_level',
|
|
'mar_status',
|
|
'mar_request_note',
|
|
'mar_reject_reason',
|
|
'mar_requested_at',
|
|
'mar_requested_by',
|
|
'mar_processed_at',
|
|
'mar_processed_by',
|
|
];
|
|
|
|
public function getLatestByMember(int $mbIdx): ?object
|
|
{
|
|
return $this->where('mb_idx', $mbIdx)
|
|
->orderBy('mar_idx', 'DESC')
|
|
->first();
|
|
}
|
|
}
|
|
|