Skip to content

Instantly share code, notes, and snippets.

@thaqebon
thaqebon / readme.md
Last active May 7, 2025 21:05
How to Use Tailwind v4 in Laravel 12 While Keeping Tailwind v3 for Filament v3 (Using Vite Separation)

🚀 How to Use Tailwind v3 for Filament v3 While Keeping Tailwind v4 in Laravel 12 (Using Vite Separation)

Problem: Laravel 12 supports Tailwind CSS v4, but Filament v3 is tied to Tailwind v3. Using both together can cause conflicts.

This guide shows how I solved the problem by isolating Filament’s frontend stack — with its own Tailwind v3, Vite config, and PostCSS config — separate from the Laravel app, which uses Tailwind v4.


🛠️ Step-by-Step Solution

@afsakar
afsakar / AdminPanelProvider.php
Last active May 14, 2025 18:16
Filter for navigation items in FilamentPHP
<?php
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\View\PanelsRenderHook;
use Illuminate\Support\Facades\Blade;
public function panel(Panel $panel): Panel
{
@neverything
neverything / CopyToS3Command.php
Created February 25, 2025 10:35
A Laravel artisan command to migrate files from one disk to another for example to move to S3-compatible object storage and back. See https://silvanhagen.com/talks/meetup-laravel-cloud/
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class CopyToS3Command extends Command
{
protected $signature = 'storage:mirror
@A909M
A909M / filament-hiding-records-in-table-until-filtered-or-searched.php
Last active May 2, 2025 17:02
If you have too many records in a single table to show immediately, you can hide them until a filter/search is applied.
->modifyQueryUsing(function (Builder $query, $livewire) {
$hasFilters = collect($livewire->tableFilters)
->filter(fn($filter) => !empty($filter['values']))
->isNotEmpty();
return ($livewire->hasTableSearch() || $hasFilters) ? $query : $query->whereRaw('1 = 0');
})
@saade
saade / FilamentServiceProvider.php
Last active May 2, 2025 16:05
My Filament Defaults
<?php
namespace App\Providers;
use Filament\Actions;
use Filament\Forms;
use Filament\Infolists;
use Filament\Notifications\Notification;
use Filament\Pages;
use Filament\Support\Enums\MaxWidth;
<?php
use App\Filament\Resources\MilestoneResource;
use App\Filament\Resources\TaskResource;
use Filament\Navigation\NavigationBuilder;
use Filament\Navigation\NavigationGroup;
use Filament\Navigation\NavigationItem;
use Filament\Panel;
public function panel(Panel $panel): Panel
@terryupton
terryupton / modal.twig
Last active March 31, 2025 09:55
Ajax Loading a page into a modal with Alpine JS
<section x-data="{showModal: false, showLoading: false, html: ''}">
<button
@click="html='loading...'; showLoading = true; showModal = !showModal;
fetch('{{ entry.url }}', {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
})