99 lines
2.8 KiB
PHP
99 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\ClassSubjectResource\Pages;
|
|
use App\Filament\Resources\ClassSubjectResource\RelationManagers;
|
|
use App\Models\ClassSubject;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
|
|
class ClassSubjectResource extends Resource
|
|
{
|
|
protected static ?string $model = ClassSubject::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
|
|
protected static ?string $navigationGroup = 'Academic Setup';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Select::make('class_room_id')
|
|
->label('Kelas')
|
|
->relationship('class', 'class_name')
|
|
->required(),
|
|
|
|
Select::make('subject_id')
|
|
->label('Mata Pelajaran')
|
|
->relationship('subject', 'name')
|
|
->required(),
|
|
|
|
Select::make('academic_year_id')
|
|
->label('Tahun Ajaran')
|
|
->relationship('academicYear', 'name') // ganti "name" jika kolomnya berbeda
|
|
->required(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('class.class_name')->label('Kelas')->sortable()->searchable(),
|
|
TextColumn::make('subject.name')->label('Mata Pelajaran')->sortable()->searchable(),
|
|
TextColumn::make('academicYear.name')->label('Tahun Ajaran')->sortable(),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListClassSubjects::route('/'),
|
|
'create' => Pages\CreateClassSubject::route('/create'),
|
|
'edit' => Pages\EditClassSubject::route('/{record}/edit'),
|
|
];
|
|
}
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return 'Mata Pelajaran per-Kelas';
|
|
}
|
|
|
|
public static function getBreadcrumb(): string
|
|
{
|
|
return 'Mata Pelajaran per-Kelas';
|
|
}
|
|
|
|
public static function getPluralModelLabel(): string
|
|
{
|
|
return 'Mata Pelajaran per-Kelas';
|
|
}
|
|
}
|