user()->can('manage_photos') || auth()->user()->can('admin'); } protected static ?string $model = Photo::class; protected static ?string $navigationIcon = 'heroicon-o-photo'; protected static ?string $navigationGroup = 'Ogólne'; protected static ?string $modelLabel = 'Zdjęcie'; protected static ?string $pluralModelLabel = 'Zdjęcia'; protected static ?int $navigationSort = 3; public static function form(Form $form): Form { return $form ->schema([ Grid::make() ->schema([ Card::make() ->schema([ FileUpload::make('image_path') ->image() ->imageEditor() ->disk('public') ->directory('photos') ->label('Zdjęcie') ->required(), TextInput::make('image_name') ->label('Nazwa') ->required(), TextInput::make('image_desc') ->label('Opis (wykorzystywany w SEO)') ->required(), ]), Card::make() ->schema([ Select::make('articles') ->multiple() ->label('Przypięte artykuły') ->nullable() ->placeholder('Wybierz artykuły') ->searchable() ->preload() ->reactive() ->relationship('articles', 'title', fn ($query) => $query->whereIn('type', ['article', 'article-with-map'])), ]), Card::make() ->schema([ Select::make('articlesNews') ->multiple() ->label('Przypięte aktualności') ->nullable() ->placeholder('Wybierz aktualności') ->searchable() ->preload() ->reactive() ->relationship('articlesNews', 'title'), ]), // Card::make() // ->schema([ // Select::make('jobOffers') // ->multiple() // ->label('Pinned job offers') // ->nullable() // ->placeholder('Select job offers') // ->searchable() // ->preload() // ->reactive() // ->relationship('jobOffers', 'title'), // ]), ])->columnSpan(8), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('image_name')->label('Nazwa')->limit(35), Tables\Columns\TextColumn::make('image_desc')->label('Opis')->limit(35), Tables\Columns\ImageColumn::make('image_path')->label('Zdjęcie'), ]) ->filters([ // ]) ->actions([ Tables\Actions\ViewAction::make(), Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListPhotos::route('/'), 'create' => Pages\CreatePhoto::route('/create'), 'view' => Pages\ViewPhoto::route('/{record}'), 'edit' => Pages\EditPhoto::route('/{record}/edit'), ]; } }