102 lines
2.8 KiB
PHP
102 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Teachers;
|
|
|
|
use App\Filament\Resources\Teachers\Pages\CreateTeacher;
|
|
use App\Filament\Resources\Teachers\Pages\EditTeacher;
|
|
use App\Filament\Resources\Teachers\Pages\ListTeachers;
|
|
use App\Models\Teacher;
|
|
use BackedEnum;
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction as ActionsEditAction;
|
|
use Filament\Forms;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
class TeacherResource extends Resource
|
|
{
|
|
protected static ?string $model = Teacher::class;
|
|
|
|
protected static ?string $navigationLabel = 'Mugallymlar';
|
|
|
|
protected static ?string $pluralLabel = 'Mugallymlar';
|
|
|
|
protected static ?string $recordTitleAttribute = 'name';
|
|
|
|
protected static ?int $navigationSort = 3;
|
|
|
|
public static function getNavigationIcon(): string|BackedEnum|Htmlable|null
|
|
{
|
|
return 'heroicon-o-user-group';
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->schema([
|
|
Forms\Components\TextInput::make('name')
|
|
->required()
|
|
->maxLength(255),
|
|
Forms\Components\FileUpload::make('photo')
|
|
->image(),
|
|
Forms\Components\Textarea::make('bio')
|
|
->columnSpanFull(),
|
|
]);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\ImageColumn::make('photo')
|
|
->label('Surat')
|
|
->circular(),
|
|
|
|
Tables\Columns\TextColumn::make('name')
|
|
->label('Ady')
|
|
->searchable(),
|
|
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
|
|
Tables\Columns\TextColumn::make('updated_at')
|
|
->dateTime()
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->recordActions([
|
|
ActionsEditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListTeachers::route('/'),
|
|
'create' => CreateTeacher::route('/create'),
|
|
'edit' => EditTeacher::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|