components([ Section::make() ->columns(2) ->schema([ Select::make('provider') ->label(__('panel.repositories.fields.provider')) ->options(GitProvider::class) ->default(GitProvider::default()) ->required() // Only providers with a driver registered in // config/git.php can actually be synced. ->disableOptionWhen(fn (string $value) => ! GitProvider::from($value)->isSupported()), TextInput::make('full_name') ->label(__('panel.repositories.fields.full_name')) ->placeholder('colectivo/mi-proyecto') ->helperText(__('panel.repositories.fields.full_name_hint')) ->required() ->maxLength(255) ->rules(['regex:/^[\w.-]+\/[\w.-]+$|^[\w.-]+$/']), Select::make('project_id') ->label(__('panel.repositories.fields.project')) ->relationship('project', 'title->'.config('locales.default')) ->getOptionLabelFromRecordUsing(TranslatedOptionLabel::using('title')) ->searchable() ->preload(), Toggle::make('is_primary') ->label(__('panel.repositories.fields.is_primary')) ->helperText(__('panel.repositories.fields.is_primary_hint')), Toggle::make('show_publicly') ->label(__('panel.repositories.fields.show_publicly')) ->default(true), ]), ]); } public static function table(Table $table): Table { return RepositoriesTable::configure($table); } /** * @return array */ public static function getGloballySearchableAttributes(): array { return ['full_name']; } public static function getPages(): array { return [ 'index' => ListRepositories::route('/'), 'create' => CreateRepository::route('/create'), 'edit' => EditRepository::route('/{record}/edit'), ]; } /** * Flags repositories whose sync keeps failing — usually renamed or deleted * upstream — so stale numbers do not sit on the public site unnoticed. */ public static function getNavigationBadge(): ?string { $failing = static::getModel()::query()->failing()->count(); return $failing > 0 ? (string) $failing : null; } public static function getNavigationBadgeColor(): ?string { return 'danger'; } }