承接 bale/core 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bale/core

Composer 安装命令:

composer require bale/core

包简介

Core for bale

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

composer require bale/core

You can publish and run the migrations with:

php artisan vendor:publish --tag="core-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="core-config"

This is the contents of the published config file:

return [
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="core-views"

Usage

$core = new Bale\Core();
echo $core->echoPhrase('Hello, Bale!');

Table Improvements (Filtering & Sorting)

Komponen tabel di bale-core telah dilengkapi dengan fitur filtering dan sorting yang terintegrasi dengan Livewire.

1. Sorting dengan x-core::table-th

Gunakan x-core::table-th di dalam slot thead untuk membuat header yang bisa diklik.

<x-slot name="thead">
    <tr>
        <x-core::table-th
            label="Nama"
            sortBy="name"
            :sortField="$sortField"
            :sortDirection="$sortDirection"
        />
    </tr>
</x-slot>

Di Livewire Component:

public $sortField = 'name';
public $sortDirection = 'asc';

public function sort($field) {
    if ($this->sortField === $field) {
        $this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
    } else {
        $this->sortField = $field;
        $this->sortDirection = 'asc';
    }
}

2. Filtering dengan x-core::table

Gunakan slot filters dan prop activeFilters untuk menambahkan UI filter.

<x-core::table
    :links="$data"
    header
    :activeFilters="array_filter(['Status' => $filterStatus])"
>
    <x-slot name="filters">
        <x-core::select-dropdown label="Status" wire:model.live="filterStatus">
            <option value="">Semua</option>
            <option value="active">Aktif</option>
        </x-core::select-dropdown>
    </x-slot>
    ...
</x-core::table>

Di Livewire Component (Untuk Reset):

public function resetFilter($field) {
    if ($field === 'Status') $this->reset('filterStatus');
}

public function resetAllFilters() {
    $this->reset(['filterStatus', 'query']);
}

3. Item Actions (core.shared-components.item-actions)

Komponen untuk tombol Edit, Delete (dengan konfirmasi dropdown), dan aksi tambahan (slot).

<livewire:core.shared-components.item-actions
    :editUrl="route('items.edit', $item->id)"
    :deleteId="$item->id"
    confirmMessage="Yakin ingin menghapus data ini?"
>
    <!-- Slot Aksi Tambahan -->
</livewire:core.shared-components.item-actions>

Integrasi dengan Deletion Trait: Komponen item-actions didesain untuk bekerja secara otomatis dengan trait penghapusan pada setiap package.

  1. Core Package: Gunakan Bale\Core\Traits\HasDeleteOption.
  2. CMS Package: Gunakan Bale\Cms\Traits\HasSafeDelete (untuk support tenant connection).

Cara Penggunaan (Contoh di CMS):

use Bale\Cms\Traits\HasSafeDelete;

class YourComponent extends Component {
    use HasSafeDelete;
    protected string $modelClass = Post::class;
}

Komponen akan otomatis memicu method performDelete() pada trait tersebut saat konfirmasi ditekan.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-18