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:
39
app/Http/Requests/PositionRequest.php
Normal file
39
app/Http/Requests/PositionRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Usermanagement\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PositionRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string',
|
||||
'level' => 'required|integer',
|
||||
];
|
||||
|
||||
if ($this->method() === 'PUT') {
|
||||
$rules['code'] = 'required|string|unique:positions,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|string|unique:positions,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user