82 lines
2.8 KiB
PHP
82 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\InternshipResource\RelationManagers;
|
|
|
|
use App\Models\InternshipApplication;
|
|
use Filament\Forms;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table; // Added this use statement
|
|
|
|
class ApplicationsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'applications';
|
|
|
|
// Add this line to define the inverse relationship
|
|
protected static ?string $model = InternshipApplication::class;
|
|
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Forms\Components\TextInput::make('name')
|
|
->required()
|
|
->maxLength(255),
|
|
Forms\Components\DatePicker::make('birthdate')
|
|
->required(),
|
|
Forms\Components\FileUpload::make('resume_file')
|
|
->required()
|
|
->acceptedFileTypes(['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'])
|
|
->disk('public') // or your preferred disk
|
|
->directory('resumes'),
|
|
Forms\Components\TextInput::make('email')
|
|
->email()
|
|
->required()
|
|
->maxLength(255),
|
|
Forms\Components\TextInput::make('phone_number')
|
|
->required()
|
|
->maxLength(20),
|
|
Forms\Components\Textarea::make('cover_letter')
|
|
->maxLength(65535)
|
|
->nullable()
|
|
->columnSpan('full'),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('name')
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('name')
|
|
->searchable()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('email')
|
|
->searchable()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('phone_number')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->headerActions([
|
|
Tables\Actions\CreateAction::make(),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
Tables\Actions\DeleteAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|