what is your blog-list view called and what folder is it in?
Aug 7, 2024
4
Level 5
Unable to find component: [blog-list]
Hi all,
I guess the path to Blog model and to the view livewire.blog-list however its not finding it.
BlogList livewire
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\Blog;
use Hashids\Hashids;
class BlogList extends Component
{
use WithPagination;
protected $paginationTheme = 'bootstrap';
public function render()
{
$hash = new Hashids('', 10); // pad to length 10
$blogs = Blog::paginate(6);
return view('livewire.blog-list',compact('blogs','hash'));
}
}
in livewire.blog-list
<div>
<!-- Blog -->
<section class="blog-area three ptb-100">
<div class="container">
<div class="row">
<div class="col-12">
<div class="row">
@if($blogs && $blogs-> count() > 0)
@foreach ($blogs as $blog)
<div class="col-md-6 col-sm-6 col-lg-4">
<div class="blog-item">
<div class="top">
<a target="_blank" href="{{ $blog->photo}}">
<img src="{{ $blog->photo}}" alt="blog" style="width: 510; height:450" title="{{ $blog->title}}" alt="{{ $blog->title}}">
</a>
</div>
<div class="bottom">
<ul>
<li>
<i class="icofont-calendar"></i>
<span>{{ Date::parse($blog->created_at) ? Date::parse($blog->created_at)->diffForHumans() : ''}}</span>
</li>
<li>
<i class="icofont-user-alt-3"></i>
<span>{{ trans('front/message.By') }}:</span>
<a href="#">{{ $blog->user->name}}</a>
</li>
</ul>
<h3>
<a href="{{ url('blog/details/'.str_replace_me($blog->title).'/'.$hash- >encodeHex($blog->id))}}" title="{{ $blog->title}}">{{ $blog->title}}</a>
</h3>
<p>{{ $blog->short_description }}</p>
<a class="blog-btn" href="{{ url('blog/details/'.str_replace_me($blog- >title).'/'.$hash->encodeHex($blog->id))}}" title="{{ $blog- >title}}">{{ trans('front/message.Read More') }}</a>
</div>
</div>
</div>
@endforeach
@endif
</div>
<div class="pagination-area">
<ul>
<li>
{{ $blogs->links() }}
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- En
in my view the blog.inbox.blade.php which is calling the livewire.blog-list
<!-- Page Title -->
<div class="page-title-area title-bg-one" style="background-image: url('{{ asset('front/assets/img/oaahd3.png')}}')">
<div class="d-table">
<div class="d-table-cell">
<div class="container">
<div class="title-item">
<h1>{{ trans('front/seo.blog_title') }}</h1>
</div>
</div>
</div>
</div>
</div>
<!-- Blog -->
@livewire('blog-list')
<!-- End Blog -->
I appreciate your help !
Level 6
Hi,
If you are using Livewire 3, your component must be in App/Livewire and not App/Http/Livewire.
Please or to participate in this conversation.