PHPackages                             pppcreative/select-badge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pppcreative/select-badge

ActiveLibrary

pppcreative/select-badge
========================

Package combines Select field and Badge field, adds styled classes in CSS and adds functions such as icons(), map(), addTypes(), options(), labels(). Added to BelongsBaadge !

2.0(2y ago)024MITPHP

Since Jun 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PPP-Peter/SelectBadge)[ Packagist](https://packagist.org/packages/pppcreative/select-badge)[ RSS](/packages/pppcreative-select-badge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

SelectBadge Field
=================

[](#selectbadge-field)

1. Preview
----------

[](#1-preview)

[![preview](preview.png)](preview.png)

2. Info
-------

[](#2-info)

Package combines Select field and Badge field, adds styled classes in CSS and adds functions such as icons(), map(), addTypes(), options(), labels().

- You can use to like simple css Badge

### How use Badge

[](#how-use-badge)

```
->displayUsing(fn($value)=> '' . $value . '')->asHtml()
->displayUsing(fn($value)=> '' . $value . '')->asHtml()
```

```
->displayUsing(fn($value)=> '' . $value . '')->asHtml(),
->displayUsing(fn($value)=> '' . $value . '')->asHtml(),
```

[![image2](image2.png)](image2.png)

### Added files:

[](#added-files)

```
 resources/css/labels-status.css - register file to NovaProvider    Nova::style('label-statuses', resource_path('css/label-statuses.css'));,
 config/wame-badge.php - config('wame-badge.warning'),
 Models/Trait/BadgeStatuses.php  --add to model,
 App\Utils\Helpers\SelectBadge.php function SelectBadge;
```

### Function

[](#function)

```
public static function select ($select, $options, $types, $icons){
    return [
        Select::make(__('fields.' .$select), $select)
            ->filterable()
            ->displayUsingLabels()
            ->onlyOnForms()
            ->options($options)
            ->rules('required')->required(),
        Badge::make(__('fields.' . $select), $select)
            ->sortable()
            ->map($options)
            ->hideWhenCreating()->hideWhenUpdating()
            ->addTypes($types)
            ->icons($icons ? $icons : $types)
            ->labels($options),
    ];
}

public static function badge ($select, $options, $types, $icons){
    return [
        Badge::make(__('fields.' . $select), $select)
            ->map($options)
            ->hideWhenCreating()->hideWhenUpdating()
            ->addTypes($types)
            ->icons($icons ? $icons : $types)
            ->labels($options),
    ];
}
```

3. Instalation
--------------

[](#3-instalation)

- ### vendor publish --SelectBadgeServiceProvider

    [](#vendor-publish----selectbadgeserviceprovider)

```
php artisan vendor:publish --provider="Wame\SelectBadge\SelectBadgeServiceProvider"
```

you can use config classes or register `Nova::style('label-statuses', resource_path('css/label-statuses.css'));` in `NovaServiceProvider.php`

4. Usage
--------

[](#4-usage)

- ### Add to your Model Trait

    [](#add-to-your-model-trait)

```
Models/Trait/BadgeStatuses.php

use App\Models\Traits\BadgeStatuses;
use BadgeStatuses;
```

- ### Add fields to your Nova Model

    [](#add-fields-to-your-nova-model)

```
use App\Utils\Helpers\SelectBadge;

//...SelectBadge::select('place_execution', $this->place(), $this->placeMap(), $this->placeType(), $this->placeIcons()  ),
...SelectBadge::select('place_execution', $this->place(), $this->place('type'), $this->place('icon')  ),
```

- ### Edit trait example:

    [](#edit-trait-example)

```
    const PLACE = [
        'OFFICE' => 1,
        'HALL' => 2,
        'EXTERIOR' => 3,
        'MOBILE' => 4,
    ];

    public function place($value=null){
        $variable = [
            __('fields.office'),
            __('fields.hall'),
            __('fields.exterior'),
            __('fields.mobile'),
        ];
        $icon = [
            'collection',
            'office-building',
            'cloud',
            'switch-vertical',
        ];
        $type = [
            'status-color-blue',
            'status-color-teal',
            'status-color-coral',
            'status-color-teal2',
        ];

        $data = ($value === 'value') ? $variable : (($value === 'icon') ? $icon : (($value === 'type') ? $type : null));

        if ($value == null) return array_combine(array_values(self::PLACE), $variable);
        if (is_array($data)) return array_combine($variable, $data);
        else return array_fill_keys($variable, $data);
    }
```

5. Configuration / Customization
--------------------------------

[](#5-configuration--customization)

\### You can add your custom classes ### If you dont want Icons use null:

[](#if-you-dont-want-icons-use-null)

```
$icon = '';
  ...SelectBadge::select('place_execution', $this->place(), $this->place('type'), place('icon')  ),
```

Icons can find here:

6. Badges class:
----------------

[](#6-badges-class)

  red green green2 blue ice teal teal2 coral aquamarine golden orange orange-light green-light green-dark pink purple   config('wame-badge.error) denied approved info default warning   config('wame-badge.error-white') denied-white approved-white info-white default-white warning-white [![colors](colors.png)](colors.png)

### config classes:

[](#config-classes)

- config('wame-badge.error')
- ...

### css classes:

[](#css-classes)

- status-bg-\[color\]
- status-color-\[color\]
- status-line-\[color\]
- status-border-\[color\]
- ...

### more:

[](#more)

- primary
- secondary
- none

OR OLDER CODE

  Kliknite sem pre zobrazenie obsahu```
    const
        OFFICE = 1,
        HALL = 2,
        EXTERIOR = 3,
        MOBILE = 4;

    public function place(): array
    {
        return [
            self::OFFICE => __('fields.office'),
            self::HALL => __('fields.hall'),
            self::EXTERIOR => __('fields.exterior'),
            self::MOBILE => __('fields.mobile'),
        ];
    }

    // uprava css / nalepky
    // you can use css class or tailwind classes from config too : config('wame-badge.info')
    public function placeType(){
        return [
            'office' => 'status-color-blue',
            'hall' => 'status-color-teal',
            'exterior' =>  'status-color-coral',
            'mobile' => 'status-color-aquamarine',
           // 'edit' => config('wame-badge.warning'),
        ];
    }

// Add Icons
    public function placeIcons(){
        return [
            'office' => 'exclamation-circle',
            'hall' => 'check-circle',
            'exterior' => 'x-circle',
            'mobile' => 'document-text',
        ];
    }
```

OR OLDER CODE

  Kliknite sem pre zobrazenie obsahu```
    const PLACE = [
        OFFICE = 1,
        HALL = 2,
        EXTERIOR = 3,
        MOBILE = 4
        ];

      public function placeVariable ($value = 'value') {
        $variable = [
            __('fields.office'),
            __('fields.hall'),
            __('fields.exterior'),
            __('fields.mobile'),
            __('fields.other'),
        ];
        $type = [
            'status-color-blue',
            'status-color-teal',
            'status-color-coral',
            'status-color-teal2',
            'status-color-default',
        ];
        $icon = 'collection';

        if ($value === 'value') return $variable;
        if ($value === 'icon') return $icon;
        if ($value === 'type') return $type;
    }
      public function place($type=null){
        if ($type == null) return array_combine(array_values(self::PLACE), $this->placeVariable());

        if (is_array($this->placeVariable($type))){
            return array_combine($this->placeVariable(), $this->placeVariable($type));
        }
        else  return array_fill_keys($this->placeVariable(), $this->placeVariable($type));
    }
```

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

1061d ago

Major Versions

0.1 → 1.02023-06-09

1.2 → 2.02023-06-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/9062e791c74e74954b33b513e75aec5d975f231eabb1ba5e96e0136614527a03?d=identicon)[PPP-Peter](/maintainers/PPP-Peter)

---

Top Contributors

[![PPP-Peter](https://avatars.githubusercontent.com/u/93872517?v=4)](https://github.com/PPP-Peter "PPP-Peter (27 commits)")

---

Tags

laravelselectstatusbadgeselectBadge

### Embed Badge

![Health badge](/badges/pppcreative-select-badge/health.svg)

```
[![Health](https://phpackages.com/badges/pppcreative-select-badge/health.svg)](https://phpackages.com/packages/pppcreative-select-badge)
```

###  Alternatives

[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[outl1ne/nova-multiselect-field

A multiple select field for Laravel Nova.

3402.9M2](/packages/outl1ne-nova-multiselect-field)[chocofamilyme/laravel-healthcheck

Serves functionality of healthchecks of your application

11105.9k](/packages/chocofamilyme-laravel-healthcheck)[cocosmos/filament-quick-add-select

Instantly create and select new options in Filament relationship selects without opening modals

131.3k](/packages/cocosmos-filament-quick-add-select)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
