Siti Rahayu преди 4 години
родител
ревизия
c63776014a
променени са 3 файла, в които са добавени 421 реда и са изтрити 318 реда
  1. 399
    296
      app/Http/Controllers/Api/CompoundResourceController.php
  2. 3
    3
      app/Http/Controllers/Api/LoginController.php
  3. 19
    19
      app/Jobs/StoreNotice.php

+ 399
- 296
app/Http/Controllers/Api/CompoundResourceController.php Целия файл

* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function generateCompoundNumber($jenis, $tag)
public function generateNumber($jenis, $tag, $modul)
{ {
//check if theres no 001, start fresh with 0001
if (empty(Compound::where('jenis', $jenis)->where('kpd', $tag.'0001')->first())) {
$num= '';


$kpd = '0001';
if($modul == '02')
{
//check if theres no 001, start fresh with 0001
if (empty(Compound::where('jenis_n', $jenis)->where('non', $tag.'0001')->first())) {


}
else{
$num = '0001';

}
else{


//check the lastest compound number stored in dbase filtered by jenis
$compound = Compound::where('jenis', $jenis)->withTrashed()->latest()->first();
//check the lastest compound number stored in dbase filtered by jenis
$notice = Compound::where('jenis_n', $jenis)->withTrashed()->latest()->first();


//sanitize compound number to return only integer
$kpd = filter_var($compound['kpd'], FILTER_SANITIZE_NUMBER_INT);
//sanitize compound number to return only integer
$num = filter_var($notice['non'], FILTER_SANITIZE_NUMBER_INT);


//compulsory increment to store new compound number, WHILE number is found, keep looping
do{
//compulsory increment to store new compound number, WHILE number is found, keep looping
do{


(int)$kpd += 1;
(int)$num += 1;


//add 0s at the fornt if number is less than 1000
if ((strlen((string) $kpd)) == 1) {
//add 0s at the fornt if number is less than 1000
if ((strlen((string) $num)) == 1) {


$kpd = '000'.$kpd;
$num = '000'.$num;


}elseif ((strlen((string)$kpd)) == 2){
}elseif ((strlen((string)$num)) == 2){


$kpd = '00'.$kpd;
$num = '00'.$num;


}elseif ((strlen((string)$kpd )) == 3) {
}elseif ((strlen((string)$num )) == 3) {


$kpd = '0'.$kpd;
}
$num = '0'.$num;
}

}while(!empty(Compound::where('jenis_n', $jenis)->where('non', $tag.$num)->first()));

}
}else if($modul == '03')
{
//check if theres no 001, start fresh with 0001
if (empty(Compound::where('jenis', $jenis)->where('kpd', $tag.'0001')->first())) {

$num = '0001';

}
else{

//check the lastest compound number stored in dbase filtered by jenis
$compound = Compound::where('jenis', $jenis)->withTrashed()->latest()->first();


}while(!empty(Compound::where('jenis', $jenis)->where('kpd', $tag.$kpd)->first()));
//sanitize compound number to return only integer
$num = filter_var($compound['kpd'], FILTER_SANITIZE_NUMBER_INT);


//compulsory increment to store new compound number, WHILE number is found, keep looping
do{

(int)$num += 1;

//add 0s at the fornt if number is less than 1000
if ((strlen((string) $num)) == 1) {

$num = '000'.$num;

}elseif ((strlen((string)$num)) == 2){

$num = '00'.$num;

}elseif ((strlen((string)$num )) == 3) {

$num = '0'.$num;
}

}while(!empty(Compound::where('jenis', $jenis)->where('kpd', $tag.$num)->first()));

}
} }



//return kpd with tag //return kpd with tag
$kpd = $tag . $kpd;
$num = $tag . $num;


return $kpd;
return $num;
} }


/** /**
$compound->nama_syarikat = $request->namaS; $compound->nama_syarikat = $request->namaS;
$compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->no_daftar_syarikat = strtolower($request->daftarNo);
$compound->alamat = $request->alamat; $compound->alamat = $request->alamat;
$compound->no_plate = $request->no_plate;
$compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->no_plate = $request->no_plate;
// $compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->nama_kawasan = $request->namaKawasan; // $compound->nama_kawasan = $request->namaKawasan;
// $compound->nama_taman = $request->namaTaman; // $compound->nama_taman = $request->namaTaman;
// $compound->nama_jalan = $request->namaJalan; // $compound->nama_jalan = $request->namaJalan;
$compound->catatan = $request->catatan; $compound->catatan = $request->catatan;
$compound->latlong = $request->Latlong; $compound->latlong = $request->Latlong;
// $compound->akta = $faulty->deed_law_id;
// $compound->seksyen_kesalahan = $faulty->_id;
// $compound->jumlah_asal_kompaun = $faulty->amount;
$compound->dikeluarkan_ = $staff->_id;
$compound->akta = $faulty->deed_law_id;
$compound->seksyen_kesalahan = $faulty->_id;
$compound->jumlah_asal_kompaun = $faulty->amount;
$compound->dikeluarkan = $staff->_id;
$compound->status = 'Belum Bayar'; $compound->status = 'Belum Bayar';
$compound->modul = '03'; $compound->modul = '03';
$compound->no_telefon = $request->tel; $compound->no_telefon = $request->tel;
$compound->no_akaun_lesen = $request->lesen; $compound->no_akaun_lesen = $request->lesen;
$compound->cpn_created = Carbon::now()->toDateTimeString();
$compound->created_c = Carbon::now()->toDateTimeString();




}elseif($request->jenis == 'Pelbagai_JPB'){ }elseif($request->jenis == 'Pelbagai_JPB'){
$compound->nama_syarikat = $request->namaS; $compound->nama_syarikat = $request->namaS;
$compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->no_daftar_syarikat = strtolower($request->daftarNo);
$compound->alamat = $request->alamat; $compound->alamat = $request->alamat;
$compound->no_plate = $request->no_plate;
$compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->no_plate = $request->no_plate;
// $compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->nama_kawasan => $request->namaKawasan; // $compound->nama_kawasan => $request->namaKawasan;
// $compound->nama_taman => $request->namaTaman; // $compound->nama_taman => $request->namaTaman;
// $compound->nama_jalan => $request->namaJalan; // $compound->nama_jalan => $request->namaJalan;
$compound->catatan = $request->catatan; $compound->catatan = $request->catatan;
$compound->latlong = $request->Latlong; $compound->latlong = $request->Latlong;
// $compound->akta => $faulty->deed_law_id;
// $compound->seksyen_kesalahan => $faulty->_id;
// $compound->jumlah_asal_kompaun => $faulty->amount;
$compound->dikeluarkan_ = $staff->_id;
$compound->akta = $faulty->deed_law_id;
$compound->seksyen_kesalahan = $faulty->_id;
$compound->jumlah_asal_kompaun = $faulty->amount;
$compound->dikeluarkan = $staff->_id;
$compound->status = 'Belum Bayar'; $compound->status = 'Belum Bayar';
$compound->modul = '03'; $compound->modul = '03';
$compound->no_telefon = $request->tel; $compound->no_telefon = $request->tel;
$compound->no_akaun_lesen = $request->lesen; $compound->no_akaun_lesen = $request->lesen;
$compound->cpn_created = Carbon::now()->toDateTimeString();


}elseif($request->jenis == 'Pelbagai_PA'){

$compound->jenis = $request->jenis;
$compound->nama = $request->namaP;
$compound->identity = $request->noIc;
$compound->nama_syarikat = $request->namaS;
$compound->no_daftar_syarikat = strtolower($request->daftarNo);
$compound->alamat = $request->alamat;
// $compound->no_plate = $request->no_plate;
// $compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->nama_kawasan = $request->namaKawasan;
// $compound->nama_taman = $request->namaTaman;
// $compound->nama_jalan = $request->namaJalan;
$compound->catatan = $request->catatan;
$compound->latlong = $request->Latlong;
// $compound->akta = $faulty->deed_law_id;
// $compound->seksyen_kesalahan = $faulty->_id;
// $compound->jumlah_asal_kompaun = $faulty->amount;
$compound->dikeluarkan_ = $staff->_id;
$compound->status = 'Belum Bayar';
$compound->modul = '03';
$compound->no_telefon = $request->tel;
$compound->no_akaun_lesen = $request->lesen;
$compound->bil_haiwan = $request->lesen;
$compound->cpn_created = Carbon::now()->toDateTimeString();


}elseif($request->jenis == 'Pelbagai_LESEN'){

$compound->jenis = $request->jenis;
$compound->nama = $request->namaP;
$compound->identity = $request->noIc;
$compound->nama_syarikat = $request->namaS;
$compound->no_daftar_syarikat = strtolower($request->daftarNo);
$compound->alamat = $request->alamat;
$compound->no_plate = $request->no_plate;
$compound->no_cukai_jalan = $request->no_cukai_jalan;
// $compound->nama_kawasan = $request->namaKawasan;
// $compound->nama_taman = $request->namaTaman;
// $compound->nama_jalan = $request->namaJalan;
$compound->catatan = $request->catatan;
$compound->latlong = $request->Latlong;
// $compound->akta = $faulty->deed_law_id;
// $compound->seksyen_kesalahan = $faulty->_id;
// $compound->jumlah_asal_kompaun = $faulty->amount;
$compound->dikeluarkan_ = $staff->_id;
$compound->status = 'Belum Bayar';
$compound->modul = '03';
$compound->no_telefon = $request->tel;
$compound->no_akaun_lesen = $request->lesen;
$compound->cpn_created = Carbon::now()->toDateTimeString();
$compound->created_c = Carbon::now()->toDateTimeString();


} }
// }elseif($request->jenis == 'Pelbagai_PA'){

// $compound->jenis = $request->jenis;
// $compound->nama = $request->namaP;
// $compound->identity = $request->noIc;
// $compound->nama_syarikat = $request->namaS;
// $compound->no_daftar_syarikat = strtolower($request->daftarNo);
// $compound->alamat = $request->alamat;
// // $compound->no_plate = $request->no_plate;
// // $compound->no_cukai_jalan = $request->no_cukai_jalan;
// // $compound->nama_kawasan = $request->namaKawasan;
// // $compound->nama_taman = $request->namaTaman;
// // $compound->nama_jalan = $request->namaJalan;
// $compound->catatan = $request->catatan;
// $compound->latlong = $request->Latlong;
// $compound->akta = $faulty->deed_law_id;
// $compound->seksyen_kesalahan = $faulty->_id;
// $compound->jumlah_asal_kompaun = $faulty->amount;
// $compound->dikeluarkan = $staff->_id;
// $compound->status = 'Belum Bayar';
// $compound->modul = '03';
// $compound->no_telefon = $request->tel;
// $compound->no_akaun_lesen = $request->lesen;
// $compound->bil_haiwan = $request->lesen;
// $compound->created_c = Carbon::now()->toDateTimeString();


// }elseif($request->jenis == 'Pelbagai_LESEN'){

// $compound->jenis = $request->jenis;
// $compound->nama = $request->namaP;
// $compound->identity = $request->noIc;
// $compound->nama_syarikat = $request->namaS;
// $compound->no_daftar_syarikat = strtolower($request->daftarNo);
// $compound->alamat = $request->alamat;
// $compound->no_plate = $request->no_plate;
// $compound->no_cukai_jalan = $request->no_cukai_jalan;
// // $compound->nama_kawasan = $request->namaKawasan;
// // $compound->nama_taman = $request->namaTaman;
// // $compound->nama_jalan = $request->namaJalan;
// $compound->catatan = $request->catatan;
// $compound->latlong = $request->Latlong;
// $compound->akta = $faulty->deed_law_id;
// $compound->seksyen_kesalahan = $faulty->_id;
// $compound->jumlah_asal_kompaun = $faulty->amount;
// $compound->dikeluarkan = $staff->_id;
// $compound->status = 'Belum Bayar';
// $compound->modul = '03';
// $compound->no_telefon = $request->tel;
// $compound->no_akaun_lesen = $request->lesen;
// $compound->created_c = Carbon::now()->toDateTimeString();

// }


$saved = $compound->save(); $saved = $compound->save();


$data = array(); $data = array();


$non = ''; $non = '';
$kpd = '';
// $kpd = '';
$no_siri =''; $no_siri ='';


// $countKPD = $this->compound->withTrashed()->count(); //for parking numbering // $countKPD = $this->compound->withTrashed()->count(); //for parking numbering
if($request->jenis == 'Parkir'){ if($request->jenis == 'Parkir'){


//for compound numbering //for compound numbering
$countKPD = $this->compound->withTrashed()->count();
$kpd = 'KPD'.$countKPD;
$non = 'KPD'.$countKPD;

$no_siri = date('yn').'-'.$countKPD.'-0';
// $countKPD = $this->compound->withTrashed()->count();
// $kpd = 'KPD'.$countKPD;
// $non = 'KPD'.$countKPD;

// $no_siri = date('yn').'-'.$countKPD.'-0';

// $compoundData = [
// 'jenis' => 'Parkir',
// 'kpd' => $kpd,
// 'non' => $non,
// 'nama' => '-',
// 'identity' => '-',
// 'alamat' => '-',
// "no_plate" => strtolower($request->no_plate),
// "no_cukai_jalan" => $request->noCukaijalan,
// "jenis_kenderaan" => $request->jenisKenderaan,
// "model_kenderaan" => $request->modelKenderaan,
// "warna_kenderaan" => $request->warnakenderaan,
// "nama_kawasan" => $request->namaKawasan,
// "nama_taman" => $request->namaTaman,
// "nama_jalan" => $request->namaJalan,
// "no_parking" => $request->noParking,
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
// 'latlong' => $request->Latlong,
// 'jbkod' => $request->jabatan,
// 'akta' => $faulty->deed_law_id,
// 'seksyen_kesalahan' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
// 'dikeluarkan' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
// "modul" => $request->modul,
// "penguatkuasa" => '-',
// "notis_created" => Carbon::now()->toDateTimeString(),
// ];
}elseif($request->jenis == 'Notis_NKG'){

// $kpd = $this->generateNumber($request->jenis, 'KT', '02');
// $non = 'NKG'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);

$non = $this->generateNumber($request->jenis, 'NKG', '02');

$no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-1';


$compoundData = [ $compoundData = [
'jenis' => 'Parkir',
'kpd' => $kpd,
'jenis_n' => $request->jenis,
'kpd' => '-',
'non' => $non, 'non' => $non,
'nama' => '-',
'identity' => '-',
'alamat' => '-',
"no_plate" => strtolower($request->no_plate),
"no_cukai_jalan" => $request->noCukaijalan,
"jenis_kenderaan" => $request->jenisKenderaan,
"model_kenderaan" => $request->modelKenderaan,
"warna_kenderaan" => $request->warnakenderaan,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"no_parking" => $request->noParking,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
'jbkod_n' => $request->jabatan,
'akta_n' => $faulty->deed_law_id,
'seksyen_kesalahan_n' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan_n' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
"modul" => $request->modul, "modul" => $request->modul,
"penguatkuasa" => '-', "penguatkuasa" => '-',
"notis_created" => Carbon::now()->toDateTimeString(),
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"tindakan" => $request->tindakan,
"tempoh" => $request->tempoh,
"created_n" => Carbon::now()->toDateTimeString(),
]; ];
}elseif($request->jenis == 'Pelbagai_KT'){
}elseif($request->jenis == 'Notis_NMH'){


$kpd = $this->generateCompoundNumber($request->jenis, 'KT');
$non = 'NKG'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);
// $kpd = $this->generateCompoundNumber($request->jenis, 'JPB');
// $non = 'NMH'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1';
$non = $this->generatedNumber($request->jenis, 'NMH', '02');

$no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-2';


$compoundData = [ $compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'jenis_n' => $request->jenis,
'kpd' => '-',
'non' => $non, 'non' => $non,
'nama' => $request->namaP, 'nama' => $request->namaP,
'identity' => $request->noIc, 'identity' => $request->noIc,
'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
'jbkod_n' => $request->jabatan,
'akta_n' => $faulty->deed_law_id,
'seksyen_kesalahan_n' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan_n' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
"modul" => $request->modul, "modul" => $request->modul,
"penguatkuasa" => '-', "penguatkuasa" => '-',
"no_telefon" => $request->tel, "no_telefon" => $request->tel,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"tindakan" => $request->tindakan, "tindakan" => $request->tindakan,
"tempoh" => $request->tempoh, "tempoh" => $request->tempoh,
"notis_created" => Carbon::now()->toDateTimeString(),
"created_n" => Carbon::now()->toDateTimeString(),
]; ];
}elseif($request->jenis == 'Pelbagai_JPB'){
}
elseif($request->jenis == 'Notis_NHN'){


$kpd = $this->generateCompoundNumber($request->jenis, 'JPB');
$non = 'NMH'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);
//HN bcs other N stands for notice. compound number no need front N
// $kpd = $this->generateCompoundNumber($request->jenis, 'HN');
// $non = 'NHN'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2';
$non = $this->generateNumber($request->jenis, 'NHN', '02' );

$no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-3';


$compoundData = [ $compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'jenis_n' => $request->jenis,
'kpd' => '-',
'non' => $non, 'non' => $non,
'nama' => $request->namaP, 'nama' => $request->namaP,
'identity' => $request->noIc, 'identity' => $request->noIc,
'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
'jbkod_n' => $request->jabatan,
'akta_n' => $faulty->deed_law_id,
'seksyen_kesalahan_n' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan_n' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
"modul" => $request->modul, "modul" => $request->modul,
"penguatkuasa" => '-', "penguatkuasa" => '-',
"no_telefon" => $request->tel, "no_telefon" => $request->tel,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"tindakan" => $request->tindakan, "tindakan" => $request->tindakan,
"tempoh" => $request->tempoh, "tempoh" => $request->tempoh,
"notis_created" => Carbon::now()->toDateTimeString(),
"created_n" => Carbon::now()->toDateTimeString(),
]; ];
} }
elseif($request->jenis == 'Pelbagai_LESEN'){
elseif($request->jenis == 'Notis_PA'){


//HN bcs other N stands for notice. compound number no need front N
$kpd = $this->generateCompoundNumber($request->jenis, 'HN');
$non = 'NHN'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);
// $kpd = $this->generateCompoundNumber($request->jenis, 'PA');
// $non = 'PA'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);

$non = $this->generateNumber($request->jenis, 'PA', '02');


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-3';
$no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-4';


$compoundData = [ $compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'jenis_n' => $request->jenis,
'kpd' => '-',
'non' => $non, 'non' => $non,
'nama' => $request->namaP, 'nama' => $request->namaP,
'identity' => $request->noIc, 'identity' => $request->noIc,
'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
'jbkod_n' => $request->jabatan,
'akta_n' => $faulty->deed_law_id,
'seksyen_kesalahan_n' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan_n' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
"modul" => $request->modul, "modul" => $request->modul,
"penguatkuasa" => '-', "penguatkuasa" => '-',
"no_telefon" => $request->tel, "no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen, "no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"notis_created" => Carbon::now()->toDateTimeString(),
"tindakan" => $request->tindakan,
"tempoh" => $request->tempoh,
"bil_haiwan" => $request->bil_haiwan,
"created_n" => Carbon::now()->toDateTimeString(),
]; ];
}
elseif($request->jenis == 'Pelbagai_PA'){
}elseif($request->jenis == 'Notis_NPPM'){

// $kpd = $this->generateCompoundNumber($request->jenis, 'PA');
// $non = 'PA'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);


$kpd = $this->generateCompoundNumber($request->jenis, 'PA');
$non = 'PA'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);
$non = $this->generateNumber($request->jenis, 'PA', '02');


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-4';
$no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-4';


$compoundData = [ $compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'jenis_n' => $request->jenis,
'kpd' => '-',
'non' => $non, 'non' => $non,
'nama' => $request->namaP, 'nama' => $request->namaP,
'identity' => $request->noIc, 'identity' => $request->noIc,
'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
'jbkod_n' => $request->jabatan,
'akta_n' => $faulty->deed_law_id,
'seksyen_kesalahan_n' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan_n' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
"modul" => $request->modul, "modul" => $request->modul,
"penguatkuasa" => '-', "penguatkuasa" => '-',
"no_telefon" => $request->tel, "no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen, "no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"tindakan" => $request->tindakan,
"tempoh" => $request->tempoh,
"bil_haiwan" => $request->bil_haiwan, "bil_haiwan" => $request->bil_haiwan,
"notis_created" => Carbon::now()->toDateTimeString(),
"created_n" => Carbon::now()->toDateTimeString(),
]; ];
} }


if($saved){ if($saved){
// $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
// if(!empty($compound)){ // if(!empty($compound)){
dispatch(new UpdateCompoundPrice($kpd));
// dispatch(new UpdateCompoundPrice($kpd));
// $tawaran = ''; // $tawaran = '';
// if($compound->jumlah_kemaskini_kompaun != ''){ // if($compound->jumlah_kemaskini_kompaun != ''){
// $tawaran = $compound->jumlah_kemaskini_kompaun; // $tawaran = $compound->jumlah_kemaskini_kompaun;


//mobile already accept 'kpd' string, so no need to change string name to 'notis'. //mobile already accept 'kpd' string, so no need to change string name to 'notis'.
array_push($data, array( array_push($data, array(
'kpd' => $kpd,
'kpd' => '-',
'non' => $non 'non' => $non
)); ));


}else { }else {


$data = array(); $data = array();
// dd($this->compound->where('jenis', 'Parkir')->withTrashed()->count());


$faulty = Faulty::where('_id',$request->get('seksyen'))->first(); $faulty = Faulty::where('_id',$request->get('seksyen'))->first();
if(!empty($faulty)){ if(!empty($faulty)){
// 'no_siri' => $no_siri, // 'no_siri' => $no_siri,
// ]; // ];



if($request->jenis == 'Parkir') if($request->jenis == 'Parkir')
{ {
//for compound numbering //for compound numbering
$countKPD = $this->compound->withTrashed()->count();
$countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count();
$kpd = 'KPD'.$countKPD; $kpd = 'KPD'.$countKPD;


$no_siri = date('yn').'-'.$countKPD.'-0'; $no_siri = date('yn').'-'.$countKPD.'-0';
"receipt" => '-', "receipt" => '-',
"modul" => '03', "modul" => '03',
"penguatkuasa" => '-', "penguatkuasa" => '-',
"cpn_created" => Carbon::now()->toDateTimeString(),
"created_c" => Carbon::now()->toDateTimeString(),
]; ];
} }
if ($request->jenis == 'Pelbagai_KT') { if ($request->jenis == 'Pelbagai_KT') {


$kpd = $this->generateCompoundNumber($request->jenis, 'KT');
$kpd = $this->generateNumber($request->jenis, 'KT', '03');


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1'; $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1';


'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan, "catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan, 'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id, 'akta' => $faulty->deed_law_id,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"tindakan" => '-', "tindakan" => '-',
"tempoh" => '-', "tempoh" => '-',
"cpn_created" => Carbon::now()->toDateTimeString(),
"created_c" => Carbon::now()->toDateTimeString(),
]; ];
} }
elseif ($request->jenis == 'Pelbagai_JPB') { elseif ($request->jenis == 'Pelbagai_JPB') {


$kpd = $this->generateCompoundNumber($request->jenis, 'JPB');
$kpd = $this->generateNumber($request->jenis, 'JPB', '03');


$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2'; $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2';


'nama_syarikat' => $request->namaS, 'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo), 'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat, 'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan, "nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman, "nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan, "nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan, "catatan" => $request->catatan,
"lokasi_kejadian" => '-',
// "lokasi_kejadian" => '-',
'latlong' => $request->Latlong, 'latlong' => $request->Latlong,
'jbkod' => $request->jabatan, 'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id, 'akta' => $faulty->deed_law_id,
"maklumat_tambahan" => '-', "maklumat_tambahan" => '-',
"tindakan" => '-', "tindakan" => '-',
"tempoh" => '-', "tempoh" => '-',
"cpn_created" => Carbon::now()->toDateTimeString(),
];
}
elseif ($request->jenis == 'Pelbagai_LESEN') {

//HN bcs other N stands for notice. compound number no need front N
$kpd = $this->generateCompoundNumber($request->jenis, 'HN');

$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-3';

$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
"modul" => $request->modul,
"penguatkuasa" => '-',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"cpn_created" => Carbon::now()->toDateTimeString(),
];
}
else if($request->jenis == 'Pelbagai_PA'){

$kpd = $this->generateCompoundNumber($request->jenis, 'PA');

$no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-4';

$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '-',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '-',
"receipt" => '-',
"modul" => $request->modul,
"penguatkuasa" => '-',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"bil_haiwan" => $request->bil_haiwan,
"cpn_created" => Carbon::now()->toDateTimeString(),
"created_c" => Carbon::now()->toDateTimeString(),
]; ];
} }
// elseif ($request->jenis == 'Pelbagai_LESEN') {

// //HN bcs other N stands for notice. compound number no need front N
// $kpd = $this->generateCompoundNumber($request->jenis, 'HN');

// $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-3';

// $compoundData = [
// 'jenis' => $request->jenis,
// 'kpd' => $kpd,
// 'nama' => $request->namaP,
// 'identity' => $request->noIc,
// 'nama_syarikat' => $request->namaS,
// 'no_daftar_syarikat' => strtolower($request->daftarNo),
// 'alamat' => $request->alamat,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
// "nama_kawasan" => $request->namaKawasan,
// "nama_taman" => $request->namaTaman,
// "nama_jalan" => $request->namaJalan,
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
// 'latlong' => $request->Latlong,
// 'jbkod' => $request->jabatan,
// 'akta' => $faulty->deed_law_id,
// 'seksyen_kesalahan' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
// 'dikeluarkan' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
// "modul" => $request->modul,
// "penguatkuasa" => '-',
// "no_telefon" => $request->tel,
// "no_akaun_lesen" => $request->lesen,
// "maklumat_tambahan" => '-',
// "created_c" => Carbon::now()->toDateTimeString(),
// ];
// }
// else if($request->jenis == 'Pelbagai_PA'){

// $kpd = $this->generateCompoundNumber($request->jenis, 'PA');

// $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-4';

// $compoundData = [
// 'jenis' => $request->jenis,
// 'kpd' => $kpd,
// 'nama' => $request->namaP,
// 'identity' => $request->noIc,
// 'nama_syarikat' => $request->namaS,
// 'no_daftar_syarikat' => strtolower($request->daftarNo),
// 'alamat' => $request->alamat,
// "no_plate" => $request->no_plate,
// "no_cukai_jalan" => $request->no_cukai_jalan,
// "nama_kawasan" => $request->namaKawasan,
// "nama_taman" => $request->namaTaman,
// "nama_jalan" => $request->namaJalan,
// "catatan" => $request->catatan,
// "lokasi_kejadian" => '-',
// 'latlong' => $request->Latlong,
// 'jbkod' => $request->jabatan,
// 'akta' => $faulty->deed_law_id,
// 'seksyen_kesalahan' => $faulty->_id,
// 'jumlah_asal_kompaun' => $faulty->amount,
// 'jumlah_kemaskini_kompaun' => '-',
// 'dikeluarkan' => $staff->_id,
// "status" => 'Belum Bayar',
// "amount_payment" => '-',
// "receipt" => '-',
// "modul" => $request->modul,
// "penguatkuasa" => '-',
// "no_telefon" => $request->tel,
// "no_akaun_lesen" => $request->lesen,
// "maklumat_tambahan" => '-',
// "bil_haiwan" => $request->bil_haiwan,
// "cpn_created" => Carbon::now()->toDateTimeString(),
// ];
// }


$fileData = [ $fileData = [
'no_siri' => $no_siri, 'no_siri' => $no_siri,

+ 3
- 3
app/Http/Controllers/Api/LoginController.php Целия файл

public function testing(Request $request) public function testing(Request $request)
{ {


$date = '2020-10-06 16:19:48';

dd(date('F Y', strtotime($date)));


$test = '02399'; //filter_var('000099', FILTER_SANITIZE_NUMBER_INT);
(int)$test += 1;
dd($test);


} }



+ 19
- 19
app/Jobs/StoreNotice.php Целия файл

// dispatch(new UpdateCompoundPrice($this->kpd)); // dispatch(new UpdateCompoundPrice($this->kpd));


$staff = Staff::with('StaffDetail')->where('_id', $this->no_badan)->first(); $staff = Staff::with('StaffDetail')->where('_id', $this->no_badan)->first();
$compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('non',$this->non)->first();
$notice = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('non',$this->non)->first();


$site = SiteSetting::first(); $site = SiteSetting::first();
$faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first();
$department = Department::where('_id', $compound->jbkod)->first();
$tawaran = '';
if($compound->jumlah_kemaskini_kompaun == ''){
$tawaran = $compound->jumlah_asal_kompaun;
}else{
$tawaran = $compound->jumlah_kemaskini_kompaun;
}
$faulty = Faulty::with('DeedLaw')->where('_id',$notice->seksyen_kesalahan_n)->first();
$department = Department::where('_id', $notice->jbkod_n)->first();
// $tawaran = '';
// if($compound->jumlah_kemaskini_kompaun == ''){
// $tawaran = $compound->jumlah_asal_kompaun;
// }else{
// $tawaran = $compound->jumlah_kemaskini_kompaun;
// }


/******************************************************************/ /******************************************************************/
$gDate = $compound->created_at->format('F Y');
$gDate = date('F Y', strtotime($notice->created_n));
$historyData = [ $historyData = [
'tarikh_kumpulan' => $gDate, 'tarikh_kumpulan' => $gDate,
]; ];
$subHistory = [ $subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'no_siri' => $notice->ConfidentialFile->no_siri,
'tajuk' => "Penguatkuasa ".$staff->StaffDetail->full_name." mengeluarkan notis ".$this->non, 'tajuk' => "Penguatkuasa ".$staff->StaffDetail->full_name." mengeluarkan notis ".$this->non,
'huraian' => "Notis ".$this->non." telah dikeluarkan oleh penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a> di bawah akta seksyen kesalahan [".$faulty->sketr."] ".$faulty->nama, 'huraian' => "Notis ".$this->non." telah dikeluarkan oleh penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a> di bawah akta seksyen kesalahan [".$faulty->sketr."] ".$faulty->nama,
]; ];
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); $groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){ if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory); $groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
$notice->ConfidentialFile->history()->attach($groupByDate);
}else{ }else{
$history = History::create($historyData); $history = History::create($historyData);
$history->subhistory()->create($subHistory); $history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
$notice->ConfidentialFile->history()->attach($history);
} }


$memo = Memo::where('itkod', $compound->seksyen_kesalahan)->get();
$memo = Memo::where('itkod', $notice->seksyen_kesalahan)->get();
if(!empty($memo)){ if(!empty($memo)){
foreach ($memo as $key => $m) { foreach ($memo as $key => $m) {
$staffD = StaffDetail::where('_id',$m->dikeluarkan)->first(); $staffD = StaffDetail::where('_id',$m->dikeluarkan)->first();
if($m->disahkan != ''){ if($m->disahkan != ''){
$compound->ConfidentialFile->memo()->attach($m);
$notice->ConfidentialFile->memo()->attach($m);


$historyData = [ $historyData = [
'tarikh_kumpulan' => $gDate, 'tarikh_kumpulan' => $gDate,
]; ];
$subHistory = [ $subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'no_siri' => $notice->ConfidentialFile->no_siri,
'tajuk' => "Penambahan Memo[ ".$m->no_rujukan." ] : ".$m->subjek." oleh ".$staffD->roles_access." ".$staffD->full_name, 'tajuk' => "Penambahan Memo[ ".$m->no_rujukan." ] : ".$m->subjek." oleh ".$staffD->roles_access." ".$staffD->full_name,
'huraian' => $m->penerangan, 'huraian' => $m->penerangan,
]; ];
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); $groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){ if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory); $groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
$notice->ConfidentialFile->history()->attach($groupByDate);
}else{ }else{
$history = History::create($historyData); $history = History::create($historyData);
$history->subhistory()->create($subHistory); $history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
$notice->ConfidentialFile->history()->attach($history);
} }
} }
} }

Loading…
Отказ
Запис