feat(usermanagement): tambahkan fitur manajemen posisi
- Tambahkan model `Position` dengan atribut `code`, `name`, `level`, serta logging aktivitas dan relasi ke `roles`. - Tambahkan migrasi untuk membuat tabel `positions` dengan soft deletes. - Tambahkan `PositionExport` untuk kebutuhan ekspor data posisi ke Excel dengan penyaringan berdasarkan kata kunci. - Buat `PositionsController` untuk CRUD posisi, termasuk validasi, ekspor, dan data API untuk DataTables. - Metode: `index`, `create`, `store`, `edit`, `update`, `destroy`, `export`, `dataForDatatables`. - Tambahkan validasi berbasis request `PositionRequest` untuk memastikan data valid sebelum disimpan/diubah. - Tambahkan tampilan blade untuk daftar posisi (`index.blade.php`) dan form tambah/edit posisi (`create.blade.php`) dengan dukungan DataTables dan SweetAlert. - Perbarui file `module.json` untuk menambahkan menu "Positions" di User Management. - Tambahkan breadcrumbs untuk halaman posisi (daftar, tambah, edit) di file `breadcrumbs.php`. - Perbarui `routes/web.php` untuk menambahkan route terkait posisi. Fitur ini memungkinkan pengelolaan posisi lengkap termasuk CRUD, ekspor, dan integrasi dengan DataTables.
This commit is contained in:
42
app/Models/Position.php
Normal file
42
app/Models/Position.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Usermanagement\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Position extends Model
|
||||
{
|
||||
use SoftDeletes, LogsActivity;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'level',
|
||||
];
|
||||
|
||||
/**
|
||||
* Retrieve the activity log options for this position.
|
||||
*
|
||||
* @return LogOptions The activity log options.
|
||||
*/
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()->logAll()->useLogName('User Management|Positions : ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the roles associated with this position.
|
||||
*/
|
||||
public function roles()
|
||||
{
|
||||
return $this->hasMany(Role::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user