wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
MIT License
1.12k stars 131 forks source link

Using Open Modal with powerGrid #114

Closed abbasmashaddy72 closed 2 years ago

abbasmashaddy72 commented 2 years ago

Trows this error:

[App\Http\Livewire\DeleteModal] does not implement [LivewireUI\Modal\Contracts\ModalComponent] interface.

When checked, the CSS and JS files were not published

using with PHP 8

PhiloNL commented 2 years ago

Make sure DeleteModal extends the ModalComponent class.

abbasmashaddy72 commented 2 years ago

Okay Thanks I got your point, I will check it out

abbasmashaddy72 commented 2 years ago

I got it fixed by implementing the ModalComponent in DeleteModal livewire controller, but unfortunately I am getting this error now

Method App\Http\Livewire\DeleteModal::closeModalOnClickAway does not exist.

Screenshot from 2021-11-16 09-49-48

@PhiloNL

PhiloNL commented 2 years ago

Are you sure you are extending instead of implementing? You need to extend the base class.


<?php

namespace App\Http\Livewire;

use LivewireUI\Modal\ModalComponent;

class HelloWorld extends ModalComponent
{
    public function render()
    {
        return view('livewire.hello-world');
    }
}
abbasmashaddy72 commented 2 years ago

Before code

`<?php

namespace App\Http\Livewire;

use Livewire\Component; use LivewireUI\Modal\Contracts\ModalComponent;

class DeleteDoctor extends Component implements ModalComponent { public function render() { return view('livewire.delete-doctor'); } }`

Now the error is

Symfony\Component\ErrorHandler\Error\FatalError Class App\Http\Livewire\DeleteDoctor cannot extend from interface LivewireUI\Modal\Contracts\ModalComponent

`<?php

namespace App\Http\Livewire;

use Livewire\Component; use LivewireUI\Modal\Contracts\ModalComponent;

class DeleteDoctor extends ModalComponent { public function render() { return view('livewire.delete-doctor'); } }`

Screenshot from 2021-11-16 15-34-20

@PhiloNL

PhiloNL commented 2 years ago

Extend LivewireUI\Modal\ModalComponent; not the contract.

Learn more here: https://philo.dev/laravel-modals-with-livewire/

abbasmashaddy72 commented 2 years ago

used use LivewireUI\Modal\Contracts\ModalComponent; in second one

abbasmashaddy72 commented 2 years ago

Okay Got your Point

abbasmashaddy72 commented 2 years ago

Thanks for the help.

That was great. @PhiloNL