Jakub
Jakub
FFilament
Created by Jakub on 9/7/2024 in #❓┊help
how to access current state of repeater item?
https://filamentphp.com/docs/3.x/infolists/entries/repeatable On the docs it has example of
RepeatableEntry::make('comments')
->schema([
TextEntry::make('author.name'),
TextEntry::make('title'),
TextEntry::make('content')
->columnSpan(2),
])
RepeatableEntry::make('comments')
->schema([
TextEntry::make('author.name'),
TextEntry::make('title'),
TextEntry::make('content')
->columnSpan(2),
])
If I wanted to mutate the title for example, how would I do that? When i do ->state and than dd record, it gives me the parent information So in this case if a post has comments, it shows me post. I want to access the specific comment?
6 replies
FFilament
Created by Jakub on 6/4/2024 in #❓┊help
Using Resource table in custom livewire component
No description
5 replies
FFilament
Created by Jakub on 6/3/2024 in #❓┊help
Looking for advice: Creating custom page with multiple tabs + resource tables
No description
18 replies
FFilament
Created by Jakub on 5/15/2024 in #❓┊help
Refreshing ParentResource Infolist when adding records in RelationManager table
What I want to do When I add a new record on a table that is added via relation manager. I want the parent resource data to update and reflect the new changes. I have a PhoneMembership->balance() calculcator on the infolist, that i would like to get updated without manually refreshing the page each time. Right now, after a new record is added to the table. I would need to manually refresh the page for the new balance to show up. First I tried doing this approach that I found here https://discord.com/channels/883083792112300104/1209193801386827776
Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
->action(function () {
$this->ownerRecord->phoneMembershipRecords()->create([
// stuff
]);

$this->dispatch('$refresh')->to(ViewPhoneMembership::class);
})
Tables\Actions\Action::make('quick-payment')->label('Quick Payment')
->action(function () {
$this->ownerRecord->phoneMembershipRecords()->create([
// stuff
]);

$this->dispatch('$refresh')->to(ViewPhoneMembership::class);
})
Next I tried to do https://discord.com/channels/883083792112300104/1103674797537366167
use Livewire\Component;

->action(function (Component $livewire) {
$this->ownerRecord->phoneMembershipRecords()->create([
//stuff
]);

$livewire->emit('refresh-view-phone-membership');
})
use Livewire\Component;

->action(function (Component $livewire) {
$this->ownerRecord->phoneMembershipRecords()->create([
//stuff
]);

$livewire->emit('refresh-view-phone-membership');
})
On the ViewPhoneMembership I added
protected $listeners = ['refresh-view-phone-membership' => '$refresh'];
protected $listeners = ['refresh-view-phone-membership' => '$refresh'];
I get this error for BadMethodCallException
7 replies
FFilament
Created by Jakub on 5/13/2024 in #❓┊help
accessing auth user in panel builder to make custom navigation
I am trying to generate a custom dashboard navigation for users based on the projects they have. So it's quick access from the sidebar. Or if they have pinned tasks ect. In the panel provider I added
->navigationItems(
collect(Project::where('workspace_id', auth()->user()->workspace_id)->get())->map(function ($project) {
return NavigationItem::make($project->name)
->url('/agency/projects/' . $project->id)
->icon('heroicon-o-briefcase')
->group('Projects');
})->toArray()
)
->navigationItems(
collect(Project::where('workspace_id', auth()->user()->workspace_id)->get())->map(function ($project) {
return NavigationItem::make($project->name)
->url('/agency/projects/' . $project->id)
->icon('heroicon-o-briefcase')
->group('Projects');
})->toArray()
)
I keep getting error
Attempt to read property "workspace_id" on null
Attempt to read property "workspace_id" on null
When I just do Project::all() it does generate the items correctly.
7 replies
FFilament
Created by Jakub on 5/12/2024 in #❓┊help
custom pages not being detected
Following these docs: https://filamentphp.com/docs/3.x/panels/resources/custom-pages I was able to make everything work on Project A so I understand I need to add them to getPages(), i created an extra settings one just to make sure im not hallucinating and I did get it working Project A - AdminPanelProvider
public static function getPages(): array
{
return [
'index' => Pages\ManageTasks::route('/'),
'schedule' => Pages\TeamSchedules::route('/team-schedules'),
'settings' => Pages\Settings::route('/settings'),
];
}

// i did register the team schedules on the panel and it works on this project
->pages([
Pages\Dashboard::class,
\App\Filament\Resources\TaskResource\Pages\TeamSchedules::class,
])
public static function getPages(): array
{
return [
'index' => Pages\ManageTasks::route('/'),
'schedule' => Pages\TeamSchedules::route('/team-schedules'),
'settings' => Pages\Settings::route('/settings'),
];
}

// i did register the team schedules on the panel and it works on this project
->pages([
Pages\Dashboard::class,
\App\Filament\Resources\TaskResource\Pages\TeamSchedules::class,
])
Project B - ManagePanelProvider The only difference that I can see is that I did not use admin, but the word manage.
// resigstered the pages on panel
->pages([
Pages\Dashboard::class,
\App\Filament\Resources\PhoneMembershipResource\Pages\OverduePhoneMemberships::class,
])

// and on the resource
public static function getPages(): array
{
return [
'index' => Pages\ListPhoneMemberships::route('/'),
'create' => Pages\CreatePhoneMembership::route('/create'),
'view' => Pages\ViewPhoneMembership::route('/{record}'),
'overdue'=> Pages\OverduePhoneMemberships::route('/overdue'),
'settings'=> Pages\Settings::route('/settings'),
// 'edit' => Pages\EditPhoneMembership::route('/{record}/edit'),
];
}
// resigstered the pages on panel
->pages([
Pages\Dashboard::class,
\App\Filament\Resources\PhoneMembershipResource\Pages\OverduePhoneMemberships::class,
])

// and on the resource
public static function getPages(): array
{
return [
'index' => Pages\ListPhoneMemberships::route('/'),
'create' => Pages\CreatePhoneMembership::route('/create'),
'view' => Pages\ViewPhoneMembership::route('/{record}'),
'overdue'=> Pages\OverduePhoneMemberships::route('/overdue'),
'settings'=> Pages\Settings::route('/settings'),
// 'edit' => Pages\EditPhoneMembership::route('/{record}/edit'),
];
}
54 replies
FFilament
Created by Jakub on 5/11/2024 in #❓┊help
Table Header Actions: How to access data?
No description
18 replies
FFilament
Created by Jakub on 5/9/2024 in #❓┊help
hiddenFrom on columns?
Is there something equivlent to visableFrom but for hideing based on breakpoint?
Tables\Columns\TextColumn::make('notes')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextColumn::make('price')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextInputColumn::make('notes')
->searchable()
->visibleFrom('lg'),
Tables\Columns\TextInputColumn::make('price')
->visibleFrom('lg')
->sortable(),
Tables\Columns\TextColumn::make('notes')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextColumn::make('price')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextInputColumn::make('notes')
->searchable()
->visibleFrom('lg'),
Tables\Columns\TextInputColumn::make('price')
->visibleFrom('lg')
->sortable(),
4 replies
FFilament
Created by Jakub on 5/7/2024 in #❓┊help
is it possible to move relationship manager into infolist table
No description
10 replies
FFilament
Created by Jakub on 4/26/2024 in #❓┊help
Filepond CORS Headers (bunnycdn)
No description
8 replies
FFilament
Created by Jakub on 4/9/2024 in #❓┊help
multiple values for default sort on tables
No description
3 replies
FFilament
Created by Jakub on 2/7/2024 in #❓┊help
default slideover
I swear I seen this somewhere haha There was a way to make the default for all modals to be slide overs, instead of setting it each time Anyone know?
5 replies
FFilament
Created by Jakub on 1/18/2024 in #❓┊help
$form markdown editor is broken after 1 submit
https://gyazo.com/8805cbf893d6760427e45cfdc7dbb371 This is how the blade view looks
<form wire:submit="create" class="relative">
{{ $this->form }}

<button type="submit"
class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 absolute top-1.5 right-6">
Submit
</button>
</form>
<form wire:submit="create" class="relative">
{{ $this->form }}

<button type="submit"
class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 absolute top-1.5 right-6">
Submit
</button>
</form>
class ViewTaskDialog extends Component implements HasForms
{
use InteractsWithForms;

public ?array $data = [];

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\MarkdownEditor::make('content')
->toolbarButtons([
'attachFiles',
'bold',
'italic',
'bulletList',
'link',
'orderedList',
])
->placeholder('Message # chat name')
->minLength(2)
->maxLength(2024)
->disableLabel()
->required()
])
->statePath('data')
->model(Task::class);
}

public function create(): void
{
$data = $this->form->getState();

$record = [
'task_id' => $this->task->id,
'user_id' => auth()->id(),
'content' => $data['content'],
'is_private' => false,
];

$record = Comment::create($record);

$this->form->fill();

$this->setTask($this->task->id);

$this->dispatch('scroll-to-bottom')->self();
}
}
class ViewTaskDialog extends Component implements HasForms
{
use InteractsWithForms;

public ?array $data = [];

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\MarkdownEditor::make('content')
->toolbarButtons([
'attachFiles',
'bold',
'italic',
'bulletList',
'link',
'orderedList',
])
->placeholder('Message # chat name')
->minLength(2)
->maxLength(2024)
->disableLabel()
->required()
])
->statePath('data')
->model(Task::class);
}

public function create(): void
{
$data = $this->form->getState();

$record = [
'task_id' => $this->task->id,
'user_id' => auth()->id(),
'content' => $data['content'],
'is_private' => false,
];

$record = Comment::create($record);

$this->form->fill();

$this->setTask($this->task->id);

$this->dispatch('scroll-to-bottom')->self();
}
}
I am not doing anything out of the ordinary aside from styling the editor with
.markdown-editor-chat-window {
.fi-fo-markdown-editor { @apply rounded-none focus-within:ring-0 ring-0 border-0 };
.CodeMirror-scroll { min-height: 5rem !important; };
}
.markdown-editor-chat-window {
.fi-fo-markdown-editor { @apply rounded-none focus-within:ring-0 ring-0 border-0 };
.CodeMirror-scroll { min-height: 5rem !important; };
}
But even when I don't have these classes, it still breaks. Any thoughts on what might be the issue?
2 replies
FFilament
Created by Jakub on 1/15/2024 in #❓┊help
How to access $table current `group by` filter? So I can dynamically hide columns
No description
5 replies
FFilament
Created by Jakub on 1/13/2024 in #❓┊help
slide-over direction
I am using the modal blade component https://filamentphp.com/docs/3.x/support/blade-components/modal#using-a-slide-over-instead-of-a-modal Not seeing anything in the docs if i want to switch the direction from right, to be on the left side.
<x-filament::modal slide-over>
{{-- Slide-over content --}}
</x-filament::modal>
<x-filament::modal slide-over>
{{-- Slide-over content --}}
</x-filament::modal>
Is it possible, and jsut not documented in the docs?
6 replies
FFilament
Created by Jakub on 1/6/2024 in #❓┊help
What does register in service provider mean?
No description
2 replies