schema([ Card::make() ->schema([ TextInput::make('name')->required(), FileUpload::make('image')->image() ->enableDownload()->directory('location')->imageCropAspectRatio('3:2') ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string { return (string) str($file->getClientOriginalName())->prepend(now()->timestamp); }), Select::make('category_id','')->multiple()->relationship('category','name')->searchable()->options(Category::all()->pluck('name', 'id'))->required(), ]) ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name')->searchable(), ImageColumn::make('image'), TextColumn::make('category.name'), ]) ->filters([ // Tables\Filters\TrashedFilter::make(), ]) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), Tables\Actions\ForceDeleteAction::make(), Tables\Actions\RestoreAction::make(), ]) ->bulkActions([ Tables\Actions\DeleteBulkAction::make(), Tables\Actions\ForceDeleteBulkAction::make(), Tables\Actions\RestoreBulkAction::make(), ]); } public static function getPages(): array { return [ 'index' => Pages\ManageLocations::route('/'), ]; } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery() ->withoutGlobalScopes([ SoftDeletingScope::class, ]); } public static function getRelations(): array { return [ RelationManagers\CategoryRelationManager::class, ]; } }