livewire-crud icon indicating copy to clipboard operation
livewire-crud copied to clipboard

Example of crud operations with TALL Stack

Crud Example of livewire best practices (TALL Stack)

crud

Installation

  • Clone the repo
git clone https://github.com/mr-punyapal/livewire-crud.git

&&

cd livewire-crud
  • Install composer dependencies
composer install
  • Install npm dependencies

npm install

  • Create a copy of your .env file

cp .env.example .env

  • Generate an app encryption key

php artisan key:generate

  • Create an empty database for our application

  • In the .env file, add database information to allow Laravel to connect to the database

  • Migrate the database


php artisan migrate

  • Seed the database

php artisan db:seed

  • Run the development server (Ctrl+C to close)

php artisan serve

Installation with Docker (Bonus)

Duplicate the .env.example file and rename it to .env.

cp .env.example .env

Change the DB host on .env file.

DB_HOST=livewire-crud-mysql

Enter into .docker/ and start containers.

# Wait until you see PHP-FPM / MySQL success messages.
docker compose up 

In another terminal, also in .docker/ folder, enter into docker container.

docker compose exec livewire-crud-app zsh

Now, inside that container terminal migrate, seed, install dependencies and start server.

# See `composer.json` to learn about it.

composer start

Done! See http://localhost:8216

Test

  • Run the test

php artisan test

give feedback on @MrPunyapal