2
votes

I'm using Laradock with Laravel 7.24, and I can't make a Blade template component work.

I've followed the tutorial from the official documentation page, so, inside the docker-machine executed:

php artisan make:component Alert

And placed the component inside of the layout blade template:

<x-alert/>

But it throws the following error:

Target class [Illuminate\Support\Facades\App\View\Components\Alert] does not exist. (View: /var/www/resources/views/layouts/app.blade.php)

Does anyone know what is the issue?

Thanks!

2
Might be related. If you're trying to make a component anonymous... 1. Remove the relevant file in app/view/components 2. Run php artisan view:clear to reset compiled viewscdwyer

2 Answers

0
votes

To use the component anonymous you need to delete class app/View/Components/Alert.php, deleting the view folder worked for me.

0
votes

Experienced with the same problem. First of all, remove the file from app/view/components this path and run php artisan view:clear this command.

Hope it will work.