Only until March 18th: coupon LARAVEL12 for 40% off Yearly/Lifetime membership!

Read more here
Courses

Livewire 3 From Scratch: Practical Course

Full-page Components to Replace Laravel Controllers

Summary of this lesson:
- Setting up routes for Livewire components
- Configuring layouts for components
- Managing page titles
- Using component-specific layouts

In general, there are two main ways to use Livewire:

  • You build the full project with Laravel Controllers, and use Livewire only for small dynamic elements on the pages
  • You use Livewire Components instead of Laravel Controllers, with so-called Full-Page Components

The choice is yours, it's a personal preference. In this lesson, let's see how to do it with full-page components.


Routes

Instead of mapping to the Controller in the Routes files, you just need to map directly to the Livewire component.

use App\Livewire\CreatePost;
 
Route::get('/posts/create', CreatePost::class);

Layout Files

Livewire uses Blade component as an application layout. So it needs to have a {{ $slot }} placeholder. By default, Livewire uses...

The full lesson is only for Premium Members.
Want to access all 30 lessons of this course? (108 min read)

You also get:

  • 71 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord