1. Go to this page and download the library: Download ht3aa/status-tabs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ht3aa / status-tabs example snippets
namespace App\Enums;
enum OrderStatus: string
{
case PENDING = 'pending';
case PROCESSING = 'processing';
case COMPLETED = 'completed';
case CANCELLED = 'cancelled';
public function getLabel(): string
{
return match($this) {
self::PENDING => 'Pending',
self::PROCESSING => 'Processing',
self::COMPLETED => 'Completed',
self::CANCELLED => 'Cancelled',
};
}
public function getIcon(): string
{
return match($this) {
self::PENDING => 'heroicon-o-clock',
self::PROCESSING => 'heroicon-o-arrow-path',
self::COMPLETED => 'heroicon-o-check-circle',
self::CANCELLED => 'heroicon-o-x-circle',
};
}
}
namespace App\Models;
use App\Enums\OrderStatus;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
protected $casts = [
'status' => OrderStatus::class,
];
}
namespace App\Filament\Resources\OrderResource\Pages;
use App\Filament\Resources\OrderResource;
use Ht3aa\StatusTabs\StatusTabs;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListOrders extends StatusTabs
{
protected static string $resource = OrderResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.