95 lines
3.0 KiB
PHP
95 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\SubjectScopeResource\Pages;
|
|
use App\Filament\Resources\SubjectScopeResource\RelationManagers;
|
|
use App\Models\SubjectScope;
|
|
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 SubjectScopeResource extends Resource
|
|
{
|
|
protected static ?string $model = SubjectScope::class;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
|
|
protected static ?string $navigationGroup = 'Academic Management';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Forms\Components\Select::make('subject_id')
|
|
->label('Subject')
|
|
->options(
|
|
fn () => \App\Models\Subject::pluck('name', 'id')->toArray()
|
|
)
|
|
->searchable()
|
|
->required(),
|
|
Forms\Components\TextInput::make('religion')
|
|
->maxLength(255),
|
|
Forms\Components\TextInput::make('learning_goal')
|
|
->required()
|
|
->maxLength(255),
|
|
Forms\Components\Textarea::make('scope')
|
|
->required()
|
|
->columnSpanFull(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('subject.name')
|
|
->numeric()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('religion')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('learning_goal')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('updated_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\ListSubjectScopes::route('/'),
|
|
'create' => Pages\CreateSubjectScope::route('/create'),
|
|
'edit' => Pages\EditSubjectScope::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|