root 4 vuotta sitten
vanhempi
commit
5c53dd8523

+ 26
- 2
app/Http/Controllers/Main/TaskController.php Näytä tiedosto

@@ -48,14 +48,17 @@ class TaskController extends Controller
if($request->modul == '02')
{
$compound = Compound::with('ConfidentialFile')->where('non',$request->non)->first();
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan_n)->first();
$jbkod = $compound->jbkod_n;
}
else{
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first();
$faulty = Faulty::with('DeedLaw', 'Department') ->where('_id', $compound->seksyen_kesalahan)->first();
$jbkod = $compound->jbkod;
}

$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
$jbkod = $compound->jbkod;

$data = [];
$now = Carbon::now();
$gDate = $now->format('F Y');

@@ -71,6 +74,24 @@ class TaskController extends Controller
{

$this->dispatch(new StoreCompoundEPBT($request->all(), $compound->kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $compound->seksyen_kesalahan));

$data = [
'non' => $compound->non,
'jenis' => $compound->jenis_n
'nama' => $compound->nama,
'identity' => $compound->identity,
'alamat' => $compound->alamat,
'nama_kawasan' =>$compound->nama_kawasan,
'nama_taman' => $compound->nama_taman,
'nama_jalan' =>$compound->nama_jalan,
'catatan' => $compound->catatan,
'latlong' => $compound->latlong,
'jabatan' => $faulty->Department->jnama,
'akta' => $faulty->DeedLaw->nama,
'tempoh' => $compound->tempoh,
'tindakan' => $compound->tindakan ?? "",
'created_n' => $compound->created_n,
];
}

$reg_id = array();
@@ -87,6 +108,8 @@ class TaskController extends Controller
}
}


if(count($reg_id) > 0) {
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', url('api/push/notification'), [
@@ -94,6 +117,7 @@ class TaskController extends Controller
'form_params' => [
'title' => $roles->name.' '.$compound->kpd,
'msg' => 'Kompaun ini telah di pindahkan ke modul '.$roles->name,
'data' => $data,
'register_id' => $reg_id,
]
]);

+ 4
- 2
app/Http/Controllers/NotificationController.php Näytä tiedosto

@@ -81,6 +81,7 @@ class NotificationController extends BaseController
public function sendNotification(Request $request){
$title = $request->title;
$msg = $request->msg;
$data = $request->data;
$register_id = $request->register_id;

if($register_id != null){
@@ -93,8 +94,9 @@ class NotificationController extends BaseController
$staff = Staff::with('StaffDetail')->where('token_firebase',$register_id[$key])->first();
if(!empty($staff)){
$dataNoti = [
'title' => $request->title,
'body' => $request->msg,
'title' => $title,
'body' => $msg,
'data' => $data,
];
$staff->notification()->create($dataNoti);
}

Loading…
Peruuta
Tallenna