Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender
This commit is contained in:
@@ -28,7 +28,7 @@ function formatTanggalIndonesia($date, $time = false)
|
||||
} catch (\Throwable $e) {
|
||||
return $date;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
50
app/Notifications/PermohonanNotif.php
Normal file
50
app/Notifications/PermohonanNotif.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user