A
A
Alexey Sklyarov2021-06-02 17:42:53
Laravel
Alexey Sklyarov, 2021-06-02 17:42:53

Why can't Laravel find a connected component class from a third party package?

Using Laravel 8 trying to install spatie/laravel-honeypot . I connected to the config/app.phpservice provider in which the blade component is connected, and directives, but when I load the page on which I try to call the component from the package, I get an error:

Unable to locate a class or view for component [honeypot]
The directive doesn't work either.

The service provider itself works if called at the end of connecting the components: Blade::getClassComponentAliases();then the list of components will contain a honeypot.

What is the reason for this behaviour?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2021-06-02
@0example

This is how I use it:
Route

Route::post('/contacts', [ContactsController::class, 'receive'])
  ->middleware([\Spatie\Honeypot\ProtectAgainstSpam::class])
  ->name('site.form.feedback');

In template
<form class="form" method="post" action="{{ route('site.form.feedback') }}">
    @csrf
    @honeypot

In configs specially connected nothing. Auto-discovery of providers and so works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question