127 lines
3.9 KiB
PHP
127 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\ClassStudentResource\Pages;
|
|
use App\Filament\Resources\ClassStudentResource\RelationManagers;
|
|
use App\Models\AcademicYear;
|
|
use App\Models\ClassRoom;
|
|
use App\Models\ClassStudent;
|
|
use App\Models\Student;
|
|
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;
|
|
|
|
class ClassStudentResource extends Resource
|
|
{
|
|
protected static ?string $model = ClassStudent::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([
|
|
Forms\Components\Select::make('class_room_id')
|
|
->label('Class Room')
|
|
->required()
|
|
->options(ClassRoom::pluck('class_name', 'id')->toArray())
|
|
->searchable()
|
|
->native(false),
|
|
|
|
Forms\Components\Select::make('student_id')
|
|
->label('Student')
|
|
->required()
|
|
->options(Student::pluck('full_name', 'id')->toArray())
|
|
->searchable()
|
|
->native(false),
|
|
|
|
Forms\Components\Select::make('academic_year_id')
|
|
->label('Academic Year')
|
|
->required()
|
|
->options(AcademicYear::pluck('name', 'id')->toArray())
|
|
->searchable()
|
|
->native(false),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('class.class_name')
|
|
->label('Class Room')
|
|
->numeric()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('student.full_name')
|
|
->label('Student')
|
|
->numeric()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('academicYear.name')
|
|
->label('Academic Year')
|
|
->numeric()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('deleted_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->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\ListClassStudents::route('/'),
|
|
'create' => Pages\CreateClassStudent::route('/create'),
|
|
'edit' => Pages\EditClassStudent::route('/{record}/edit'),
|
|
];
|
|
}
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return 'Kelas per-Siswa';
|
|
}
|
|
|
|
public static function getBreadcrumb(): string
|
|
{
|
|
return 'Kelas per-Siswa';
|
|
}
|
|
|
|
public static function getPluralModelLabel(): string
|
|
{
|
|
return 'Kelas per-Siswa';
|
|
}
|
|
}
|