5

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!

1
  • 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 views Commented Jun 9, 2021 at 0:43

2 Answers 2

10

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.