feat(custom-field): tambahkan fungsi untuk mendapatkan custom field
- Menambahkan fungsi getCustomField untuk mengambil custom field berdasarkan ID atau nama. - Memperbarui penggunaan model customField di file Lpj.php.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Lpj\Models\customField;
|
||||
use Modules\Lpj\Models\HolidayCalendar;
|
||||
use Modules\Lpj\Models\PenawaranDetailTender;
|
||||
use Modules\Lpj\Models\PenawaranTender;
|
||||
@@ -359,3 +360,16 @@ function getNomorLaporan($permohonanId, $documentId){
|
||||
])->first();
|
||||
return $laporan->nomor_laporan ?? null;
|
||||
}
|
||||
|
||||
function getCustomField($param){
|
||||
if(is_numeric($param)){
|
||||
$field = CustomField::find($param);
|
||||
} else {
|
||||
$field = CustomField::where(['name' => $param])->first();
|
||||
}
|
||||
if($field){
|
||||
return $field;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user