feat: ms pegawai resource
This commit is contained in:
parent
a373fedb94
commit
5b267f372f
84
app/Filament/Resources/MsPegawaiResource.php
Normal file
84
app/Filament/Resources/MsPegawaiResource.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MsPegawaiResource\Pages;
|
||||||
|
use App\Filament\Resources\MsPegawaiResource\RelationManagers;
|
||||||
|
use App\Models\MsPegawai;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
|
||||||
|
class MsPegawaiResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = MsPegawai::class;
|
||||||
|
|
||||||
|
protected static ?string $pluralModelLabel = 'Master Pegawai';
|
||||||
|
protected static ?string $navigationGroup = 'Master data';
|
||||||
|
protected static ?int $navigationSort = 2;
|
||||||
|
protected static ?string $navigationLabel = "Data Pegawai";
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\TextInput::make('id_pegawai')->label('ID Pegawai')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
Forms\Components\TextInput::make('nama_pegawai')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
//
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->defaultSort('created_at', 'desc')
|
||||||
|
->searchable()
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('id_pegawai')->label('ID Pegawai'),
|
||||||
|
TextColumn::make('nama_pegawai')->label('Nama Pegawai'),
|
||||||
|
TextColumn::make('created_at')->label('Tanggal Dibuat'),
|
||||||
|
TextColumn::make('updated_at')->label('Tanggal Diubah'),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\ViewAction::make(),
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
Tables\Actions\DeleteAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListMsPegawais::route('/'),
|
||||||
|
'create' => Pages\CreateMsPegawai::route('/create'),
|
||||||
|
'view' => Pages\ViewMsPegawai::route('/{record}'),
|
||||||
|
'edit' => Pages\EditMsPegawai::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MsPegawaiResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MsPegawaiResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateMsPegawai extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = MsPegawaiResource::class;
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MsPegawaiResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MsPegawaiResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditMsPegawai extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = MsPegawaiResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\ViewAction::make(),
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MsPegawaiResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MsPegawaiResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListMsPegawais extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = MsPegawaiResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make()->label('Tambah Pegawai'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\MsPegawaiResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\MsPegawaiResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewMsPegawai extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = MsPegawaiResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make()->label('Edit Pegawai'),
|
||||||
|
Actions\DeleteAction::make()->label('Hapus Pegawai'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,5 +8,6 @@ class MsPegawai extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'ms_pegawai';
|
protected $table = 'ms_pegawai';
|
||||||
protected $primaryKey = 'id_pegawai';
|
protected $primaryKey = 'id_pegawai';
|
||||||
|
protected $keyType = 'string';
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user