Laravel Many-To-Many Relationship working and fetching correct data, but shows “null” on access

in my Laravel application, I have many to many relationships with 2 tables, ls_blogs & ls_blog_categories, with the ls_blog_category_ls_blog table as a pivot, here is the code for better context
ls_blogs migration:

Schema::create('ls_blogs', function (Blueprint $table) {
            $table->id();
            $table->string('title');
 ..Other fields.

ls_blog_categories migration:

if (!Schema::hasTable('ls_blog_categories')) {
            Schema::create('ls_blog_categories', function (Blueprint $table) {
                $table->id();
                $table->string('name');
                $table->boolean('active')->default(false);
                $table->timestamps();
            });
        }

Pivot

  Schema::create('ls_blog_category_ls_blog', function (Blueprint $table) {
            $table->id();
            $table->foreignId('ls_blog_id')->nullable()->constrained()->nullOnDelete();
            $table->foreignId('ls_blog_category_id')->nullable()->constrained()->nullOnDelete();
            $table->timestamps();
        });

LsBlog Model:

public function categories()
    {
        return $this->belongsToMany(LsBlogCategory::class, 'ls_blog_category_ls_blog', 'ls_blog_id', 'ls_blog_category_id')
            ->wherePivotNotNull('ls_blog_category_id')
            ->where('ls_blog_categories.active', true);
    }

LsBlogCategory Model

   public function blogs()
    {
        return $this->belongsToMany(LsBlog::class, 'ls_blog_category_ls_blog')
            ->wherePivotNotNull('ls_blog_id')
            ->where('ls_blogs.is_active', true);
    }

Livewire Component trying to access

    public function mount($id)
    {
        $this->blog = LsBlog::with('categories')->find($id);
        dd($this->blog, $this->blog->categories); 

Result:

Try with this i fix it with adding the layout attribut to the Livewire component and it works fine :
LsBlog Model :

namespace AppModels;

use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;

class LsBlog extends Model
{
    use HasFactory;

    protected $fillable = ['title'];

    public function categories()
    {
        return $this->belongsToMany(LsBlogCategory::class,'ls_blog_category_ls_blog');
    }
}

LsBlogCategory Model :

namespace AppModels;

use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;

class LsBlogCategory extends Model
{
    use HasFactory;

    protected $fillable = ['name', 'active'];

    public function blogs()
    {
        return $this->belongsToMany(LsBlog::class, 'ls_blog_category_ls_blog');
    }
}

lsblogs migration :

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('ls_blogs', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ls_blogs');
    }
};

ls_blog_categories Migration :

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('ls_blog_categories', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->boolean('active')->default(false);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ls_blog_categories');
    }
};

ls_blog_category_ls_blog Migration :

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('ls_blog_category_ls_blog', function (Blueprint $table) {
            $table->id();
            $table->foreignId('ls_blog_category_id')->constrained('ls_blog_categories');
            $table->foreignId('ls_blog_id')->constrained('ls_blogs');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ls_blog_category_ls_blog');
    }
};

Livewire Component :

namespace AppLivewire;

use LivewireComponent;
use AppModelsLsBlog;
use LivewireAttributesLayout;

#[Layout('layouts.app')]
class BlogShow extends Component
{
    public $blog;

    public function mount($id)
    {
        $this->blog = LsBlog::with('categories')->findOrFail($id);
    }

    public function render()
    {
        return view('livewire.blog-show');
    }
}

Livewire view :

<div class="container">
    @if ($blog)
        <h1>{{ $blog->title }}</h1>

        <h3>Categories:</h3>
        <ul>
            @forelse ($blog->categories as $category)
                <li>
                    {{ $category->name }}
                    <br> Created At: {{ $category->pivot->created_at }}
                    <br> Updated At: {{ $category->pivot->updated_at }}
                </li>
            @empty
                <li>No categories available.</li>
            @endforelse
        </ul>
    @else
        <p>Blog not found.</p>
    @endif
</div>

layout :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Application</title>

    @livewireStyles
</head>
<body>
    {{ $slot }}

    @livewireScripts
</body>
</html>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật