Matthew
Matthew
FFilament
Created by Matthew on 4/25/2024 in #❓┊help
Github/Gitlab Actions
I want to make a github/gitlab action that checks if LOCM/SLOC *100% > 15% In other words, Percentage of lines of comments (% LOCM). Can anyone point me in the right direction?
4 replies
FFilament
Created by Matthew on 4/17/2024 in #❓┊help
How can I change emptystate with the tabs?
class ListMovies extends ListRecords
{
protected static string $resource = MovieResource::class;

public function getTabs(): array
{
return [
'all' => Tab::make()
->icon('heroicon-m-bars-arrow-down'),
'Favorites' => Tab::make()
->icon('heroicon-o-star')
->modifyQueryUsing(function (Builder $query) {
$userFavorites = Auth::user()->favorites ?? [];

return $query->whereIn('id', $userFavorites);
}),
'Downloaded' => Tab::make()
->icon('heroicon-m-folder-arrow-down'),
// ->modifyQueryUsing(fn (Builder $query) => $query->where('active', false)),
];
}
}
class ListMovies extends ListRecords
{
protected static string $resource = MovieResource::class;

public function getTabs(): array
{
return [
'all' => Tab::make()
->icon('heroicon-m-bars-arrow-down'),
'Favorites' => Tab::make()
->icon('heroicon-o-star')
->modifyQueryUsing(function (Builder $query) {
$userFavorites = Auth::user()->favorites ?? [];

return $query->whereIn('id', $userFavorites);
}),
'Downloaded' => Tab::make()
->icon('heroicon-m-folder-arrow-down'),
// ->modifyQueryUsing(fn (Builder $query) => $query->where('active', false)),
];
}
}
So if no records are found, how can I change the description for each different tab? Is it even possible?
4 replies
FFilament
Created by Matthew on 4/12/2024 in #❓┊help
Cant display modal with custom view
No description
6 replies
FFilament
Created by Matthew on 4/6/2024 in #❓┊help
Header action take 30s to respond
No description
13 replies
FFilament
Created by Matthew on 4/5/2024 in #❓┊help
Scale child div based on parent div
How can I make the Overlay Content with the Trailer button above the Summary scale in size based on the background image? Sometimes the background image is short in height and the overlay content overflows. I want it to scale down in size so it can fit inside the background image.
<div class="relative w-full rounded-lg overflow-hidden">
<!-- Background Image -->
<img class='w-full rounded-lg' src='{{$this->largeCover}}' alt="Background Image">
<!-- Gradient Overlay -->
<div class="absolute top-0 left-0 right-0 bottom-0 bg-gradient-to-b from-transparent to-zinc-800"></div>

<!-- Overlay Content with the Trailer button above the Summary -->
<div class="absolute bottom-0 left-0 w-full p-4">
<!-- Modal Toggle Button -->
<div class="flex flex-col items-center w-[15rem] mb-8">
<div class="inline-block w-full h-[22.5rem] overflow-hidden rounded-t-2xl">
<img class="w-full h-full object-cover rounded-t-2xl" src="{{$this->record['large_cover_image']}}" alt="" /> <!-- Cover image -->
</div>
<button data-modal-target="movieModal" data-modal-toggle="movieModal" class="h-10 w-full bg-green-700 hover:bg-green-800 font-bold">Watch</button>
<button data-modal-target="trailerModal" data-modal-toggle="trailerModal" class="h-10 w-full rounded-b-2xl bg-red-700 hover:bg-red-800 font-bold">Trailer</button>
</div>

<!-- Summary Content -->
<div class="transition-all duration-700 ease-in-out max-h-32 overflow-hidden hover:max-h-96 bg-black/50 text-white p-4 rounded-lg backdrop-blur-md">
<div class="text-3xl font-bold">Summary</div>
@if($this->summary)
<div>{{$this->summary}}</div>
@else
<div class="text-neutral-200 italic">Not provided :(</div>
@endif
</div>
</div>
</div>
<div class="relative w-full rounded-lg overflow-hidden">
<!-- Background Image -->
<img class='w-full rounded-lg' src='{{$this->largeCover}}' alt="Background Image">
<!-- Gradient Overlay -->
<div class="absolute top-0 left-0 right-0 bottom-0 bg-gradient-to-b from-transparent to-zinc-800"></div>

<!-- Overlay Content with the Trailer button above the Summary -->
<div class="absolute bottom-0 left-0 w-full p-4">
<!-- Modal Toggle Button -->
<div class="flex flex-col items-center w-[15rem] mb-8">
<div class="inline-block w-full h-[22.5rem] overflow-hidden rounded-t-2xl">
<img class="w-full h-full object-cover rounded-t-2xl" src="{{$this->record['large_cover_image']}}" alt="" /> <!-- Cover image -->
</div>
<button data-modal-target="movieModal" data-modal-toggle="movieModal" class="h-10 w-full bg-green-700 hover:bg-green-800 font-bold">Watch</button>
<button data-modal-target="trailerModal" data-modal-toggle="trailerModal" class="h-10 w-full rounded-b-2xl bg-red-700 hover:bg-red-800 font-bold">Trailer</button>
</div>

<!-- Summary Content -->
<div class="transition-all duration-700 ease-in-out max-h-32 overflow-hidden hover:max-h-96 bg-black/50 text-white p-4 rounded-lg backdrop-blur-md">
<div class="text-3xl font-bold">Summary</div>
@if($this->summary)
<div>{{$this->summary}}</div>
@else
<div class="text-neutral-200 italic">Not provided :(</div>
@endif
</div>
</div>
</div>
7 replies
FFilament
Created by Matthew on 4/3/2024 in #❓┊help
Unhandled match case '...'
Its caused by
<x-filament::icon-button icon="heroicon-o-user-circle" size="w-12 h-12" label="New label" />
<x-filament::icon-button icon="heroicon-o-user-circle" size="w-12 h-12" label="New label" />
Im not sure why. Any ideas?
10 replies
FFilament
Created by Matthew on 4/3/2024 in #❓┊help
filament tabs from blade dont have content
How can I add content to the tabs directly from blade? As it is now, Its just the tab items themselves
<x-filament::tabs x-data="{ activeTab: 'tab1' }">
<x-filament::tabs.item alpine-active="activeTab === 'tab1'" x-on:click="activeTab = 'tab1'">
Details
</x-filament::tabs.item>

<x-filament::tabs.item alpine-active="activeTab === 'tab2'" x-on:click="activeTab = 'tab2'">
Cast
</x-filament::tabs.item>

</x-filament::tabs>
<x-filament::tabs x-data="{ activeTab: 'tab1' }">
<x-filament::tabs.item alpine-active="activeTab === 'tab1'" x-on:click="activeTab = 'tab1'">
Details
</x-filament::tabs.item>

<x-filament::tabs.item alpine-active="activeTab === 'tab2'" x-on:click="activeTab = 'tab2'">
Cast
</x-filament::tabs.item>

</x-filament::tabs>
50 replies
FFilament
Created by Matthew on 4/3/2024 in #❓┊help
Help with github actions
I copied the workflow file from filament:
name: phpstan

on:
push:
pull_request:

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.2, 8.1]
laravel: [10.*]
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
exclude:
- laravel: 11.*
php: 8.1
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, pdo_sqlite
coverage: none
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "filament/support" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan
name: phpstan

on:
push:
pull_request:

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.2, 8.1]
laravel: [10.*]
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
exclude:
- laravel: 11.*
php: 8.1
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, pdo_sqlite
coverage: none
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "filament/support" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan
Any help?
19 replies
FFilament
Created by Matthew on 4/2/2024 in #❓┊help
Deferring loading
What does it actually do for tables?
5 replies
FFilament
Created by Matthew on 3/19/2024 in #❓┊help
Halting the creation process
Not sure if Ive asked this before, but how is it possible to have a record before we create a record?
use Filament\Notifications\Actions\Action;
use Filament\Notifications\Notification;

protected function beforeCreate(): void
{
if (! $this->getRecord()->team->subscribed()) {
Notification::make()
->warning()
->title('You don\'t have an active subscription!')
->body('Choose a plan to continue.')
->persistent()
->actions([
Action::make('subscribe')
->button()
->url(route('subscribe'), shouldOpenInNewTab: true),
])
->send();

$this->halt();
}
}
use Filament\Notifications\Actions\Action;
use Filament\Notifications\Notification;

protected function beforeCreate(): void
{
if (! $this->getRecord()->team->subscribed()) {
Notification::make()
->warning()
->title('You don\'t have an active subscription!')
->body('Choose a plan to continue.')
->persistent()
->actions([
Action::make('subscribe')
->button()
->url(route('subscribe'), shouldOpenInNewTab: true),
])
->send();

$this->halt();
}
}
https://filamentphp.com/docs/3.x/panels/resources/creating-records#halting-the-creation-process
8 replies
FFilament
Created by Matthew on 3/6/2024 in #❓┊help
Error after switching to pgsql
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: text ->> unknown LINE 1: ...ifications"."notifiable_id" is not null and "data"->>'format... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. https://flareapp.io/share/LPlp21DP I never had this issue with mariadb, but as soon as I switched to pgsql and migrating, I get this error. Summerizing: 1) Im on production with ubuntu and postgres 2) Im running octane 3) Issue appeared after switching to pgsql. It was fine with mariadb
11 replies
FFilament
Created by Matthew on 3/4/2024 in #❓┊help
Split component only takes up half the form
No description
6 replies
FFilament
Created by Matthew on 2/27/2024 in #❓┊help
Cannot change width of section in split layout
public function form(Form $form): Form
{
return $form
// ->extraAttributes(['max-width' => '100%'])
->schema([
Split::make([
Section::make([

])->columns(2),
Section::make([

])->grow(false)->extraAttributes(['width'=>'20%']),
])->from('sm')
])->statePath('data');
}
public function form(Form $form): Form
{
return $form
// ->extraAttributes(['max-width' => '100%'])
->schema([
Split::make([
Section::make([

])->columns(2),
Section::make([

])->grow(false)->extraAttributes(['width'=>'20%']),
])->from('sm')
])->statePath('data');
}
The section on the right, is taking too much space and I want to reduce its width, but it doesnt work. Any ideas?
4 replies
FFilament
Created by Matthew on 2/24/2024 in #❓┊help
Select doesnt have dafault value on filters form
Filter::make("filters")
->form([
Select::make('status_id')
->label('Status')
->columnSpan(1)
->options(TicketStatus::all()->pluck('name', 'id'))
->multiple()
->searchable()
->native(false),
Select::make('reporter_user_id')
->label('User')
->columnSpan(1)
->options(User::all()->pluck('name', 'id'))
->default(User::find(1)->name)
->multiple()
->searchable()
->native(false),
])
Filter::make("filters")
->form([
Select::make('status_id')
->label('Status')
->columnSpan(1)
->options(TicketStatus::all()->pluck('name', 'id'))
->multiple()
->searchable()
->native(false),
Select::make('reporter_user_id')
->label('User')
->columnSpan(1)
->options(User::all()->pluck('name', 'id'))
->default(User::find(1)->name)
->multiple()
->searchable()
->native(false),
])
As you can see from the picture, the default value isnt applied to the select form. Is there a reason for that? Thanks
5 replies
FFilament
Created by Matthew on 2/23/2024 in #❓┊help
How can I have MaxWidth::Full just on the form and not the whole page?
Not sure if its mentioned somewhere in the docs. All I could find was this https://filamentphp.com/docs/3.x/panels/pages#customizing-the-maximum-content-width
6 replies
FFilament
Created by Matthew on 2/23/2024 in #❓┊help
What does persistFiltersInSession and deferFilters actually mean?
Its all in the title :)
3 replies
FFilament
Created by Matthew on 2/22/2024 in #❓┊help
How to add actions to custom header view
Trait method Filament\Actions\Concerns\InteractsWithActions::afterActionCalled has not been applied as App\Filament\Resources\TicketsResource\Pages\ViewTickets::afterActionCalled, because of collision with Filament\Resources\Pages\Concerns\InteractsWithRecord::afterActionCalled https://flareapp.io/share/w5BZG2v5
22 replies
FFilament
Created by Matthew on 2/20/2024 in #❓┊help
How can I give ToggleButtons custom colors?
ToggleButtons::make('feedback')
->label('What kind of ticket would you like to open?')
->options(TicketsStatus::all()->pluck('name', 'id'))
->colors(TicketsStatus::all()->pluck('ticket_color', 'id'))
->grouped()
->extraAttributes([
'style' => 'width: 100%;' // Ensure it takes full width
])
->columnSpan(6),
ToggleButtons::make('feedback')
->label('What kind of ticket would you like to open?')
->options(TicketsStatus::all()->pluck('name', 'id'))
->colors(TicketsStatus::all()->pluck('ticket_color', 'id'))
->grouped()
->extraAttributes([
'style' => 'width: 100%;' // Ensure it takes full width
])
->columnSpan(6),
TicketsStatus has a name and ticket_color column, but how can I give to each button each respective color? Is that even possible?
9 replies
FFilament
Created by Matthew on 2/20/2024 in #❓┊help
How to make ToggleButtons span though the columns of forms
No description
4 replies
FFilament
Created by Matthew on 2/14/2024 in #❓┊help
Tab blade component doesnt have schema
How can I add a schema to the tabs blade component. I couldnt find anything in the documentation....
<x-filament::tabs>
<x-filament::tabs.item :active="$activeTab === 'tab1'" wire:click="$set('activeTab', 'tab1')">
Tab 1
</x-filament::tabs.item>

<x-filament::tabs.item :active="$activeTab === 'tab2'" wire:click="$set('activeTab', 'tab2')">
Tab 2
</x-filament::tabs.item>

<x-filament::tabs.item :active="$activeTab === 'tab3'" wire:click="$set('activeTab', 'tab3')">
Tab 3
</x-filament::tabs.item>
</x-filament::tabs>
<x-filament::tabs>
<x-filament::tabs.item :active="$activeTab === 'tab1'" wire:click="$set('activeTab', 'tab1')">
Tab 1
</x-filament::tabs.item>

<x-filament::tabs.item :active="$activeTab === 'tab2'" wire:click="$set('activeTab', 'tab2')">
Tab 2
</x-filament::tabs.item>

<x-filament::tabs.item :active="$activeTab === 'tab3'" wire:click="$set('activeTab', 'tab3')">
Tab 3
</x-filament::tabs.item>
</x-filament::tabs>
https://filamentphp.com/docs/3.x/support/blade-components/tabs
7 replies