← Voltar para projetos
CRUDs Laravel Livewire
The skeleton application for the Laravel framework.
#Laravel CRUD: Breeze + Livewire and Alpine.js Version
This project is a simple Laravel CRUD for Posts model built on top of Laravel Breeze starter kit, adding Livewire + Alpine functionality.

#Installation
Follow these steps to set up the project locally:
-
Clone the repository:
git clone https://github.com/LaravelDaily/CRUDs-Laravel-Livewire project cd project -
Install dependencies:
composer install npm install && npm run build -
Copy the
.envfile and configure your environment variables:cp .env.example .env
-
Generate the application key:
php artisan key:generate
-
Set up the database:
- Update
.envwith your database credentials. - Run migrations and seed the database, repo includes fake posts:
php artisan migrate --seed
- Update
-
If you use Laravel Herd/Valet, access the application at
http://project.test. -
Log in with credentials:
test@example.comandpassword.
#Features to Pay Attention To
This project goes beyond the default Laravel Breeze setup with the following enhancements.
- Uses Laravel Breeze but not its official Livewire Volt version. Instead, the project uses Blade version of Breeze, adding Livewire only for create/edit forms with dynamic elements.
- Also, the project doesn't use Livewire full-page components, it uses Laravel
PostControllerand the full layout comes from Laravel Breeze starter kit - Creates two Livewire components:
Posts/CreateandPosts/Edit - Adds
sluginput field with auto-generating the slug as the post title is being typed, with 1-second delay:wire:model.live.debounce.1s - Utilizes PHP Attribute
#Validateto define the validation rules for the fields - Uses Alpine.js to show the number of characters remained in the post body in "live" mode:
<span x-text="body ? body.length : 0"> - Uses "flash" messages in the session to show the result after store/update/delete:
session()->flash('message', 'Post updated successfully'); - Includes Pest test file
PostsTestthat has methods to test all Livewire form elements and also validation of each field.

#Found a bug? Got a question/idea?
Raise a GitHub issue or email info@laraveldaily.com.