DeveloperBreeze

Livewire Development Tutorials, Guides & Insights

Unlock 5+ expert-curated livewire tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your livewire skills on DeveloperBreeze.

Tutorial

Livewire Cheat Sheet: PHP & JavaScript Tips

  • Target a specific component by passing its name or ID:
   $this->emitTo('componentName', 'eventName', $optionalData);

Oct 24, 2024
Read More
Tutorial
javascript php

Managing WYSIWYG Editors with Livewire: A Step-by-Step Guide

<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.18/summernote-bs4.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.18/summernote-bs4.min.js"></script>

This ensures that Summernote is properly loaded and ready to use in your application.

Aug 14, 2024
Read More
Tutorial
javascript php

Implementing Real-Time Search with Livewire in Laravel

<?php

namespace App\Http\Livewire;

use Livewire\Component;
use App\Models\Post;

class SearchPosts extends Component
{
    public $query = '';
    public $posts = [];

    public function updatedQuery()
    {
        $this->posts = Post::where('title', 'like', '%' . $this->query . '%')->get();
    }

    public function render()
    {
        return view('livewire.search-posts');
    }
}

Next, create the Blade view for this component in resources/views/livewire/search-posts.blade.php.

Aug 14, 2024
Read More
Tutorial
php

Dynamically Updating Form Fields with Livewire in Laravel

  • Category Selection: The selectedCategory property is bound to the category dropdown. When a category is selected, the updatedSelectedCategory method is triggered.
  • Dynamic Subcategory Loading: The updatedSelectedCategory method calls getSubcategories to fetch the corresponding subcategories based on the selected category. The subcategories property is then updated, which dynamically updates the subcategory dropdown in the view.
  • Livewire Magic: Livewire automatically listens to the changes in the selectedCategory property and re-renders the relevant parts of the view without a full page reload.

Using Livewire to create dynamic forms is a powerful way to improve user experience by updating form fields in real-time based on user input. This tutorial demonstrated how to set up a dynamic dropdown menu in Laravel using Livewire, but the principles can be applied to any form field.

Aug 14, 2024
Read More
Tutorial
javascript php

Managing Modals with Livewire and JavaScript

We'll create a system to open and close modals using Livewire and JavaScript by dispatching custom events.

Create a Livewire component, or use an existing one where you want to manage modals.

Aug 14, 2024
Read More