Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender

This commit is contained in:
2025-04-22 17:19:52 +07:00
4 changed files with 70 additions and 2 deletions

View File

@@ -562,3 +562,14 @@ function ubahNomorHp($nomorHp) {
return "Nomor HP tidak valid";
}
}
function formatNotifikasi($data){
$data = json_decode(json_encode($data->data));
$data = $data->data;
$notifikasi = [
'title'=> 'Permohonan : '.$data->nomor_registrasi,
'message'=> 'Status : '.str_replace(['-','_'],' ',ucwords($data->status))
];
return $notifikasi;
}

View File

@@ -22,11 +22,13 @@ use Modules\Lpj\Models\NilaiPlafond;
use Modules\Lpj\Models\Permohonan;
use Modules\Lpj\Models\StatusPermohonan;
use Modules\Lpj\Models\TujuanPenilaian;
use Modules\Lpj\Notifications\PermohonanNotif;
use Modules\Lpj\Services\PermohonanHistoryService;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use Modules\Lpj\Models\Penilaian;
use Modules\Usermanagement\Models\User;
class PermohonanController extends Controller
{
@@ -63,6 +65,10 @@ class PermohonanController extends Controller
// Save to database
$permohonan = Permohonan::create($validate);
$user_ = User::find($permohonan->created_by);
$user_->notify(new PermohonanNotif($permohonan));
// Create history
$this->historyService->createHistory(
$permohonan,

View File

@@ -7,6 +7,7 @@
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Wildside\Userstamps\Userstamps;
use Illuminate\Notifications\Notifiable;
/**
@@ -14,7 +15,7 @@
*/
class Base extends Model
{
use LogsActivity, SoftDeletes, Userstamps;
use LogsActivity, SoftDeletes, Userstamps, Notifiable;
protected $connection;

View File

@@ -0,0 +1,50 @@
<?php
namespace Modules\Lpj\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class PermohonanNotif extends Notification
{
use Queueable;
protected $permohonan;
/**
* Create a new notification instance.
*/
public function __construct($permohonan)
{
$this->permohonan = $permohonan;
}
/**
* Get the notification's delivery channels.
*/
public function via($notifiable): array
{
return ['mail','database'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail($notifiable): MailMessage
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', 'https://laravel.com')
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*/
public function toArray($notifiable): array
{
return [
'data' => $this->permohonan,
];
}
}