116 lines
3.7 KiB
PHP
116 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\CareerResource\Pages;
|
|
use App\Filament\Resources\CareerResource\RelationManagers;
|
|
use App\Models\Career;
|
|
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\Repeater;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Textarea;
|
|
|
|
class CareerResource extends Resource
|
|
{
|
|
protected static ?string $model = Career::class;
|
|
|
|
protected static ?string $navigationGroup = 'Careers';
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-briefcase';
|
|
|
|
public static function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
TextInput::make('title')
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
TextInput::make('location')
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
Textarea::make('title_description')
|
|
->label('Description (show on modal)')
|
|
->required()
|
|
->maxLength(65535)
|
|
->columnSpan('full'),
|
|
|
|
TextInput::make('salary_per_month')
|
|
->required()
|
|
->numeric()
|
|
->label('Salary per month')
|
|
->maxLength(255),
|
|
Repeater::make('bullets')
|
|
->schema([
|
|
TextInput::make('bullet')
|
|
->required()
|
|
->maxLength(255),
|
|
])
|
|
->minItems(1)
|
|
->defaultItems(1)
|
|
->columnSpan('full'),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('title')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('title_description')
|
|
->searchable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('salary_per_month')
|
|
->searchable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
Tables\Columns\TextColumn::make('location')
|
|
->searchable(),
|
|
Tables\Columns\TextColumn::make('salary')
|
|
->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 [
|
|
RelationManagers\ApplicationsRelationManager::class,
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListCareers::route('/'),
|
|
'create' => Pages\CreateCareer::route('/create'),
|
|
'edit' => Pages\EditCareer::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|