| No | +Aktivitas | +Pengguna | +Aksi | +Waktu | ++ |
|---|
diff --git a/.gitignore b/.gitignore index 1ac4356..18b36a9 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ yarn-error.log !/storage/logs/ public/assets/homepage/*Zone.Identifier Zone.Identifier +*Zone.Identifier diff --git a/app/Helpers/CustomHelper.php b/app/Helpers/CustomHelper.php index 4968eaa..fe6c9a3 100644 --- a/app/Helpers/CustomHelper.php +++ b/app/Helpers/CustomHelper.php @@ -434,3 +434,106 @@ function titlefy($text) { } } } + +if (!function_exists('get_activity_log_name')) { + function get_activity_log_name($name) { + + switch($name) { + case 'airing_proof_theme': + return [ + 'name' => 'Tema Bukti Tayang', + 'route' => 'dashboard.airing.proof.themes.show' + ]; + case 'announcement': + return [ + 'name' => 'Pengumuman', + 'route' => 'dashboard.announcements.show' + ]; + case 'classification': + return [ + 'name' => 'Klasifikasi', + 'route' => 'dashboard.classifications.show' + ]; + case 'content_recap': + return [ + 'name' => 'Rekap Konten', + 'route' => 'dashboard.content.recaps.show' + ]; + case 'content_recap_classification': + return [ + 'name' => 'Klasifikasi Rekap Konten', + 'route' => 'dashboard.content.recap.classifications.show' + ]; + case 'cooperation': + return [ + 'name' => 'Kerja Sama', + 'route' => 'dashboard.cooperations.show' + ]; + case 'cooperation_completion': + return [ + 'name' => 'Penyelesaian Kerja Sama', + 'route' => 'dashboard.cooperation.completions.show' + ]; + case 'cooperation_proposal': + return [ + 'name' => 'Pengajuan Kerja Sama', + 'route' => 'dashboard.cooperations.media.proposal.show' + ]; + case 'government_agency': + return [ + 'name' => 'OPD', + 'route' => 'dashboard.government.agencies.show' + ]; + case 'issue_management': + return [ + 'name' => 'Manajemen Isu', + 'route' => 'dashboard.issue.managements.show' + ]; + case 'location': + return [ + 'name' => 'Location', + 'route' => 'dashboard.locations.show' + ]; + case 'media_monitoring': + return [ + 'name' => 'Monitoring Media', + 'route' => 'dashboard.media.monitorings.show' + ]; + case 'news': + return [ + 'name' => 'Berita', + 'route' => 'dashboard.news.show' + ]; + case 'order': + return [ + 'name' => 'Media Order', + 'route' => 'dashboard.media.orders.show' + ]; + case 'airing_proof_report': + return [ + 'name' => 'Laporan Bukti Tayang', + 'route' => 'dashboard.reports.show' + ]; + case 'user_role': + return [ + 'name' => 'Hak Akses', + 'route' => 'dashboard.role.index' + ]; + case 'sub_classification': + return [ + 'name' => 'Sub Klasifikasi', + 'route' => 'dashboard.sub.classifications.show' + ]; + case 'sub_location': + return [ + 'name' => 'Sub Lokasi', + 'route' => 'dashboard.sub.locations.show' + ]; + default: + return [ + 'name' => 'Tidak Valid', + 'route' => null + ]; + } + } +} diff --git a/app/Http/Controllers/Dashboard/DatatableController.php b/app/Http/Controllers/Dashboard/DatatableController.php index ab9ea53..df55e91 100644 --- a/app/Http/Controllers/Dashboard/DatatableController.php +++ b/app/Http/Controllers/Dashboard/DatatableController.php @@ -36,6 +36,7 @@ use SebastianBergmann\Type\TrueType; use Yajra\DataTables\DataTables; use Illuminate\Support\Str; +use Spatie\Activitylog\Models\Activity; class DatatableController extends Controller { @@ -3191,4 +3192,63 @@ public function loginHistory(Request $request){ return response()->json(['error' => 'Unauthorized'], 401); } + + public function logActivity(Request $request){ + if ($request->ajax()) { + + $year = $request->input('year', null); + $from_month = $request->input('from_month', null); + $to_month = $request->input('to_month', null); + $date = $request->input('date', null); + + $query = Activity::query(); + + if ($year) { + $query->whereYear('created_at', $year); + } + + if ($from_month && $to_month) { + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + $query->whereBetween('created_at', [$start, $end]); + } + + if ($date) { + $query->whereDate('created_at', $date); + } + + $data = $query->get(); + + return DataTables::of($data) + ->addIndexColumn() + ->addColumn('causer', function ($data) { + return $data->causer->name; + }) + ->addColumn('action_type', function ($data) { + switch($data->event){ + case 'created': + return 'Membuat'; + case 'updated': + return 'Mengedit'; + case 'deleted': + return 'Menghapus'; + default: + return 'Tidak Diketahui'; + } + }) + ->addColumn('time', function ($data) { + return '['.idn_date($data->created_at, 'H:i').']'. ' '.idn_date($data->created_at, 'd F Y').''; + }) + ->addColumn('action', function ($data) { + $route = route('dashboard.log.activity.show', ['id' => encrypt_id($data->id)]); + return ' Lihat'; + }) + ->rawColumns(['time', 'action_type', 'action']) + ->make(true); + } + + return response()->json(['error' => 'Unauthorized'], 401); + + } } diff --git a/app/Http/Controllers/Dashboard/LogActivityController.php b/app/Http/Controllers/Dashboard/LogActivityController.php new file mode 100644 index 0000000..6dc6153 --- /dev/null +++ b/app/Http/Controllers/Dashboard/LogActivityController.php @@ -0,0 +1,31 @@ + 'Log', + 'year' => $request->input('year', null), + 'from_month' => $request->input('from_month', null), + 'to_month' => $request->input('to_month', null), + 'date' => $request->input('date', null), + 'event' => $request->input('event', null), + ]); + } + + public function show($id){ + $log = Activity::findOrFail(decrypt_id($id)); + + // dd($log); + return view('dashboard.log-activities.show', [ + 'title' => 'Log', + 'log' => $log + ]); + } +} diff --git a/app/Http/Requests/ContentRecapClassificationRequest.php b/app/Http/Requests/ContentRecapClassificationRequest.php index 34ab169..6cc397a 100644 --- a/app/Http/Requests/ContentRecapClassificationRequest.php +++ b/app/Http/Requests/ContentRecapClassificationRequest.php @@ -26,6 +26,7 @@ public function rules(): array return [ 'name' => ['required', 'max:100'], 'description' => ['nullable'], + 'year' => ['required'], 'slug' => ['required'], 'enhancer_id' => ['required'], ]; @@ -36,6 +37,7 @@ public function messages(): array return [ 'name.required' => 'Nama harus diisi.', 'name.max' => 'Nama tidak boleh lebih dari 100 karakter.', + 'year.required' => 'Tahun harus diisi.', 'description.nullable' => 'Deskripsi bersifat opsional.', ]; } diff --git a/app/Models/AiringProofTheme.php b/app/Models/AiringProofTheme.php index c55aca2..9939571 100644 --- a/app/Models/AiringProofTheme.php +++ b/app/Models/AiringProofTheme.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class AiringProofTheme extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'airing_proof_themes'; protected $fillable = [ @@ -21,4 +23,29 @@ class AiringProofTheme extends Model public function enhancer(){ return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly(['name', 'slug', 'year', 'description', 'enhancer_id']) // kolom yang dicatat + ->useLogName('airing_proof_theme') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Tema bukti tayang '{$this->name}' telah {$eventName}"; + } } diff --git a/app/Models/ContentRecap.php b/app/Models/ContentRecap.php index a88556b..aa3efd4 100644 --- a/app/Models/ContentRecap.php +++ b/app/Models/ContentRecap.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class ContentRecap extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'content_recaps'; protected $fillable = [ @@ -31,4 +33,39 @@ public function enhancer() public function classification(){ return $this->belongsTo(ContentRecapClassification::class, 'classification_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'content_theme', + 'posted_date', + 'channel', + 'link', + 'classification_id', + 'social_media', + 'image', + 'content_type', + 'description', + 'enhancer_id',]) // kolom yang dicatat + ->useLogName('content_recap') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Rekap Konten '{$this->content_theme}' telah {$eventName}"; + } } diff --git a/app/Models/ContentRecapClassification.php b/app/Models/ContentRecapClassification.php index 1b6db1b..3865841 100644 --- a/app/Models/ContentRecapClassification.php +++ b/app/Models/ContentRecapClassification.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class ContentRecapClassification extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'content_recap_classifications'; protected $fillable = [ @@ -25,4 +27,29 @@ public function contentRecaps(){ public function enhancer(){ return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly(['name', 'slug', 'year', 'description', 'enhancer_id']) // kolom yang dicatat + ->useLogName('content_recap_classification') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Klasifikasi Rekap Konten '{$this->name}' telah {$eventName}"; + } } diff --git a/app/Models/Cooperation.php b/app/Models/Cooperation.php index 4c9c065..315bd0b 100644 --- a/app/Models/Cooperation.php +++ b/app/Models/Cooperation.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class Cooperation extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'cooperations'; @@ -36,4 +38,37 @@ public function proposals(){ public function mediaOrder(){ return $this->hasOne(Order::class, 'cooperation_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'name', + 'start_date', + 'end_date', + 'banner', + 'offer_file_template', + 'description', + 'enhancer_id', + ]) // kolom yang dicatat + ->useLogName('cooperation') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Kerja Sama '{$this->name}' telah {$eventName}"; + } } diff --git a/app/Models/CooperationCompletion.php b/app/Models/CooperationCompletion.php index 357f8d6..b4bc043 100644 --- a/app/Models/CooperationCompletion.php +++ b/app/Models/CooperationCompletion.php @@ -3,9 +3,12 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class CooperationCompletion extends Model { + use LogsActivity; protected $table = 'cooperation_completions'; protected $fillable = [ @@ -28,4 +31,40 @@ public function order(){ public function media(){ return $this->belongsTo(Media::class, 'media_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'payment_request_letter', + 'invoice', + 'bank_reference', + 'electronic_tax_invoice', + 'other_document', + 'description', + 'status', + 'rejection_reason', + 'media_id', + 'order_id', + ]) + ->useLogName('cooperation_completion') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Penyelesaian kerja sama telah {$eventName}"; + } } diff --git a/app/Models/CooperationProposal.php b/app/Models/CooperationProposal.php index 56cf43d..e053c47 100644 --- a/app/Models/CooperationProposal.php +++ b/app/Models/CooperationProposal.php @@ -4,9 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class CooperationProposal extends Model { + use LogsActivity; protected $table = 'cooperation_proposals'; @@ -34,4 +37,37 @@ public function journalists() ->using(JournalistCooperationProposal::class) ->withTimestamps(); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'attachment', + 'status', + 'e_catalog', + 'description', + 'rejection_reason', + 'cooperation_id', + 'media_id', + ]) + ->useLogName('cooperation_proposal') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Pengajuan kerja sama telah {$eventName}"; + } } diff --git a/app/Models/GovernmentAgency.php b/app/Models/GovernmentAgency.php index 94f1ee3..41452d0 100644 --- a/app/Models/GovernmentAgency.php +++ b/app/Models/GovernmentAgency.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class GovernmentAgency extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'government_agencies'; @@ -29,4 +31,29 @@ public function issues() public function enhancer(){ return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly(['name', 'short_name', 'location', 'description', 'enhancer_id']) // kolom yang dicatat + ->useLogName('government_agency') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "OPD '{$this->name}' telah {$eventName}"; + } } diff --git a/app/Models/IssueManagement.php b/app/Models/IssueManagement.php index 3a18063..fd020e7 100644 --- a/app/Models/IssueManagement.php +++ b/app/Models/IssueManagement.php @@ -5,10 +5,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class IssueManagement extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'issue_managements'; @@ -52,4 +54,39 @@ public function enhancer(){ return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'location_id', + 'sub_location_id', + 'classification_id', + 'sub_classification_id', + 'media_monitoring_id', + 'issue', + 'response', + 'description', + 'enhancer_id', + ]) // kolom yang dicatat + ->useLogName('issue_management') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Manajemen Isu telah {$eventName}"; + } + } diff --git a/app/Models/MediaMonitoring.php b/app/Models/MediaMonitoring.php index e1758aa..e1d6b12 100644 --- a/app/Models/MediaMonitoring.php +++ b/app/Models/MediaMonitoring.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class MediaMonitoring extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'media_monitorings'; @@ -38,4 +40,45 @@ public function enhancer() return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'code', + 'media_name', + 'theme', + 'title', + 'channel', + 'writter', + 'link', + 'news_page', + 'quote', + 'content', + 'influencer', + 'keyword', + 'image', + 'release_date', + 'enhancer_id', + ]) // kolom yang dicatat + ->useLogName('media_monitoring') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Monitoring Media '{$this->title}' telah {$eventName}"; + } + } diff --git a/app/Models/Order.php b/app/Models/Order.php index e4f4a22..122c66e 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -4,10 +4,13 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; + class Order extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'orders'; @@ -40,4 +43,37 @@ public function reports(){ public function completions(){ return $this->hasMany(CooperationCompletion::class, 'order_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'start_date', + 'end_date', + 'image', + 'task_description', + 'required_reports', + 'cooperation_id', + 'enhancer_id', + ]) // kolom yang dicatat + ->useLogName('order') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Media Order telah {$eventName}"; + } } diff --git a/app/Models/Report.php b/app/Models/Report.php index 65eacbb..e2d1088 100644 --- a/app/Models/Report.php +++ b/app/Models/Report.php @@ -4,10 +4,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class Report extends Model { - use SoftDeletes; + use SoftDeletes, LogsActivity; protected $table = 'reports'; @@ -30,4 +32,39 @@ public function order(){ public function media(){ return $this->belongsTo(Media::class, 'media_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'title', + 'publication_date', + 'link', + 'proof', + 'description', + 'status', + 'rejection_reason', + 'media_id', + 'order_id', + ]) // kolom yang dicatat + ->useLogName('airing_proof_report') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Penyelesaian kerja sama '{$this->title}' telah {$eventName}"; + } } diff --git a/app/Models/Role.php b/app/Models/Role.php index ae36b74..91ab271 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -3,9 +3,12 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class Role extends Model { + use LogsActivity; protected $table = 'user_roles'; protected $fillable = [ @@ -16,4 +19,32 @@ class Role extends Model public function user(){ return $this->hasMany(User::class, 'role_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ + 'name', + 'description' + ]) // kolom yang dicatat + ->useLogName('user_role') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Hak Akses (role) telah {$eventName}"; + } } diff --git a/app/Models/SubLocation.php b/app/Models/SubLocation.php index 0022f8c..154075b 100644 --- a/app/Models/SubLocation.php +++ b/app/Models/SubLocation.php @@ -3,9 +3,13 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Spatie\Activitylog\Traits\LogsActivity; +use Spatie\Activitylog\LogOptions; class SubLocation extends Model { + use LogsActivity; + protected $table = 'sub_locations'; protected $fillable = [ @@ -27,4 +31,29 @@ public function issues(){ public function enhancer(){ return $this->belongsTo(User::class, 'enhancer_id', 'id'); } + + public function getActivitylogOptions(): LogOptions + { + return LogOptions::defaults() + ->logOnly([ 'name', 'status', 'description', 'location_id', 'enhancer_id']) // kolom yang dicatat + ->useLogName('sub_location') // nama log + ->logOnlyDirty(); // hanya log kalau ada perubahan + } + + public function getDescriptionForEvent(string $eventName): string + { + switch($eventName){ + case 'created': + $eventName = 'dibuat'; + break; + case 'updated': + $eventName = 'diubah'; + break; + case 'deleted': + $eventName = 'dihapus'; + break; + } + + return "Sub Lokus '{$this->name}' telah {$eventName}"; + } } diff --git a/resources/views/dashboard/content-recaps/classifications/create.blade.php b/resources/views/dashboard/content-recaps/classifications/create.blade.php index 32e3c4a..825776f 100644 --- a/resources/views/dashboard/content-recaps/classifications/create.blade.php +++ b/resources/views/dashboard/content-recaps/classifications/create.blade.php @@ -44,7 +44,7 @@
Basic info, like your name and address, that you use on Nio Platform.
+