Live Wire မှာ ဘာွေပါ။
Each Livewire component consists of two files:
1. PHP Class File
- Location:
app/Livewire/
directory - Purpose: Contains the component logic, properties, and methods
- Example:
This file:
- Extends
Livewire\Component
- Contains public properties that are available in the view
- Has methods like
mount()
,render()
, and custom methods - Handles data processing and business logic
2. Blade View File
- Location:
resources/views/livewire/
directory - Purpose: Contains the HTML template and presentation logic
- Example:
This file:
- Contains HTML markup with Blade syntax
- Can access properties from the PHP class
- Uses Livewire directives like
wire:poll
,wire:click
, etc. - Handles the visual presentation
Naming Convention
- PHP Class:
ClinicTvDisplayV2
(PascalCase) - Blade View:
clinic-tv-display-v2.blade.php
(kebab-case) - Component Tag:
<livewire:clinic-tv-display-v2 />
(kebab-case)
When you create a Livewire component using php artisan make:livewire ComponentName
, Laravel automatically creates both files with the proper naming convention and basic structure.
Written on October 2, 2025