Daniel Reales
Daniel Reales
FFilament
Created by Daniel Reales on 1/21/2025 in #❓┊help
Spatie Media Library not show images correctly in grid
No description
7 replies
FFilament
Created by Daniel Reales on 1/21/2025 in #❓┊help
Spatie Media Library not show images correctly in grid
No description
7 replies
FFilament
Created by Daniel Reales on 1/21/2025 in #❓┊help
Spatie Media Library not show images correctly in grid
No description
7 replies
FFilament
Created by Klavan on 11/19/2024 in #❓┊help
Public method [mountAction] not found on component when adding an action to Livewire component.
You were right, I needed to add the traits and interfaces. Thanks!
5 replies
FFilament
Created by Klavan on 11/19/2024 in #❓┊help
Public method [mountAction] not found on component when adding an action to Livewire component.
Same here! Were you able to do this?
5 replies
FFilament
Created by Daniel Reales on 1/7/2025 in #❓┊help
Error opening modal from headerActions
token.list is rendering a livewire component with a table:
<?php

namespace App\Livewire\Tokens;

class ListTokens extends Component implements HasForms, HasTable
{
use InteractsWithForms;
use InteractsWithTable;

public User $user;

public function mount(User $user): void
{
$this->user = $user;
}

public function table(Table $table): Table
{
return $table
->relationship(fn (): MorphMany => $this->user->tokens())
->inverseRelationship('tokens')
->columns([
TextColumn::make('name'),
TextColumn::make('tokenable.name')
->label('User'),
TextColumn::make('created_at')
->toggleable(isToggledHiddenByDefault: true),
])
->headerActions([
Tables\Actions\CreateAction::make('create_token')
->label('Crear Token')
->icon('heroicon-o-plus')
->createAnother(false)
->modal()
->mountUsing(function (Form $form) {
$form->fill(['tokenable_id' => $this->user->id]);
})
->using(function (array $data): Model {
$user = User::find($data['tokenable_id']);
$token = $user->createToken($data['name']);

Session::flash('token', $token->plainTextToken);

return $token->accessToken;
})
->form(fn (Form $form) => TokenResource::form($form))
])
}
public function render(): View
{
return view('livewire.tokens.list-tokens');
}
}
<?php

namespace App\Livewire\Tokens;

class ListTokens extends Component implements HasForms, HasTable
{
use InteractsWithForms;
use InteractsWithTable;

public User $user;

public function mount(User $user): void
{
$this->user = $user;
}

public function table(Table $table): Table
{
return $table
->relationship(fn (): MorphMany => $this->user->tokens())
->inverseRelationship('tokens')
->columns([
TextColumn::make('name'),
TextColumn::make('tokenable.name')
->label('User'),
TextColumn::make('created_at')
->toggleable(isToggledHiddenByDefault: true),
])
->headerActions([
Tables\Actions\CreateAction::make('create_token')
->label('Crear Token')
->icon('heroicon-o-plus')
->createAnother(false)
->modal()
->mountUsing(function (Form $form) {
$form->fill(['tokenable_id' => $this->user->id]);
})
->using(function (array $data): Model {
$user = User::find($data['tokenable_id']);
$token = $user->createToken($data['name']);

Session::flash('token', $token->plainTextToken);

return $token->accessToken;
})
->form(fn (Form $form) => TokenResource::form($form))
])
}
public function render(): View
{
return view('livewire.tokens.list-tokens');
}
}
3 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
It works perfectly, I really wanted to get something that was not viable. Thank you very much for the help!
14 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
I've been trying it out but the textarea starts to increase almost at the end of the viewport. When it starts to increase the height gets lost at the end and can't be seen. Maybe I should scroll the page instead of the textarea... I have to try.
14 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
I want to scroll continuously on the bottom of my textarea while streaming content
14 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
I tried but it doesn't work
14 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
with this works perfectly, except that it doesn't continue all the way to the end of the viewport. That is, since the screen is larger, it can't be seen all the way to the bottom.:
<textarea
x-data="{
outputLogModel: $wire.$entangle('outputLog'),
resize() {
$el.style.height = '0px';
$el.style.height = $el.scrollHeight + 'px';
}
}"
x-init="$nextTick(() => {
const messagesContainer = $el; // Asume que el contenedor es el propio textarea
const observer = new MutationObserver(() => {
resize();
});

observer.observe(messagesContainer, {
childList: true,
subtree: true,
});

// Initial resize
resize();
})"
x-on:input="resize()"
wire:stream="stream"
autofocus
rows="3"
class="filament-input block w-full transition duration-75 rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 border-gray-300 resize-none"
>{{ $outputLog }}</textarea>
<textarea
x-data="{
outputLogModel: $wire.$entangle('outputLog'),
resize() {
$el.style.height = '0px';
$el.style.height = $el.scrollHeight + 'px';
}
}"
x-init="$nextTick(() => {
const messagesContainer = $el; // Asume que el contenedor es el propio textarea
const observer = new MutationObserver(() => {
resize();
});

observer.observe(messagesContainer, {
childList: true,
subtree: true,
});

// Initial resize
resize();
})"
x-on:input="resize()"
wire:stream="stream"
autofocus
rows="3"
class="filament-input block w-full transition duration-75 rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 border-gray-300 resize-none"
>{{ $outputLog }}</textarea>
14 replies
FFilament
Created by Daniel Reales on 11/20/2024 in #❓┊help
resize textarea with wire:stream
This is my textarea
<textarea
x-data="{
outputLogModel: $wire.$entangle('outputLog'),
resize() {
$el.style.height = '0px';
$el.style.height = $el.scrollHeight + 'px';
}
}"
x-init="$nextTick(resize); $watch('outputLogModel', () => resize())"
x-on:input="resize()"
wire:stream="stream"
wire:model="outputLog"
rows="3"
class="filament-input block w-full transition duration-75 rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 border-gray-300 resize-none"
>{{ $outputLog }}</textarea>
<textarea
x-data="{
outputLogModel: $wire.$entangle('outputLog'),
resize() {
$el.style.height = '0px';
$el.style.height = $el.scrollHeight + 'px';
}
}"
x-init="$nextTick(resize); $watch('outputLogModel', () => resize())"
x-on:input="resize()"
wire:stream="stream"
wire:model="outputLog"
rows="3"
class="filament-input block w-full transition duration-75 rounded-lg shadow-sm focus:ring-primary-500 focus:border-primary-500 border-gray-300 resize-none"
>{{ $outputLog }}</textarea>
14 replies
FFilament
Created by Daniel Reales on 2/18/2024 in #❓┊help
No refresh component
With the new version of livewire 3 you don't need it. https://livewire.laravel.com/docs/events#listening-for-events
6 replies
FFilament
Created by Daniel Reales on 2/18/2024 in #❓┊help
No refresh component
I used that: #[On('updateTicket')] above the function. I hope it helps you
6 replies
FFilament
Created by Daniel Reales on 5/19/2024 in #❓┊help
Listening for broadcast events multi-tenancy
This is my Listener in the component Livewire:
public function getListeners(): array
{
return [
'echo-private:'.'stores.'.Filament::getTenant()->id.',RefreshAppointmentsEvent' => 'refreshData',
];
}
public function getListeners(): array
{
return [
'echo-private:'.'stores.'.Filament::getTenant()->id.',RefreshAppointmentsEvent' => 'refreshData',
];
}
3 replies
FFilament
Created by Daniel Reales on 4/10/2024 in #❓┊help
Select default relationship
Now that I think about it, it could even stay that way. jeje
8 replies
FFilament
Created by Daniel Reales on 4/10/2024 in #❓┊help
Select default relationship
Exactly, now all queries are saved in session even if the Tenant changes
8 replies
FFilament
Created by Daniel Reales on 4/10/2024 in #❓┊help
Select default relationship
But If I change between tenants always keep the first Tenant default: Select::make('stores') ->multiple() ->relationship('stores', 'name') ->searchable() ->preload() ->default([Filament::getTenant()->id]) ->options(auth()->user()->stores()->pluck('name', 'id')) ->label('Tiendas'),
8 replies
FFilament
Created by Daniel Reales on 4/10/2024 in #❓┊help
Select default relationship
thank you so much! It's works now
8 replies
FFilament
Created by headbanger on 2/9/2024 in #❓┊help
listener not working via echo
Could you resolve it?
3 replies