silveira's avatar

silveira started a new conversation+100 XP

3mos ago

after i update my project to livewire 4 i am getting this error when i am trying run some action in my component.

I am using filament v5 table and his action

here is my code

//... existing code
            ->recordActions([
                Action::make('delete')
                    ->label('Excluir')
                    ->icon('heroicon-o-trash')
                    ->color('danger')
                    ->requiresConfirmation()
                    ->action(fn (Inventory $inventory): bool|null => $inventory->delete()),
            ])

my view


<section class="container mx-auto p-4">
    <x-heading
        :heading="__('Inventory')"
        :subheading="__('Manage your inventory items')"
    />

    {{ $this->table }}
</section>
silveira's avatar

silveira liked a comment+100 XP

3mos ago

I just resolved it per method injection for example:

public function create(ICourseRepository $_course)
{
       $this->reset(); // Reset all fields
       $this->categories = $_courses->allCategories(); // Fetch all categories
       $this->dispatch('openCourseModal', ['title' => 'কোর্স যোগ করুন']); // Dispatch an event to open the modal
}

Just like that, It works for me. Thank you everyone for allowing me some of your valuable time.

silveira's avatar

silveira wrote a reply+100 XP

3mos ago

still works

silveira's avatar

silveira liked a comment+100 XP

3mos ago

Answering my own question, in case other's are looking for this.

    /** @return BelongsTo<Programme, $this> */
    public function programme(): BelongsTo
    {
        return $this->belongsTo(Programme::class);
    }

It works with Larastan 3.0.0

silveira's avatar

silveira wrote a reply+100 XP

3mos ago

i add this helper function

silveira's avatar

silveira wrote a reply+100 XP

3mos ago

do you found some fix for this? i am using vscode and te have same error

silveira's avatar

silveira liked a comment+100 XP

5mos ago

I would suggest moving the query from your view to your controller instead, and pass it to the view. Let the controller talk to the db.