Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phi-rakib/laravel-tailwind-crud
Laravel TailwindCSS CRUD Example
https://github.com/phi-rakib/laravel-tailwind-crud
blade blade-template crud laravel laravel-framework php tailwindcss
Last synced: 16 days ago
JSON representation
Laravel TailwindCSS CRUD Example
- Host: GitHub
- URL: https://github.com/phi-rakib/laravel-tailwind-crud
- Owner: phi-rakib
- License: mit
- Created: 2024-06-25T14:04:38.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T17:13:40.000Z (4 months ago)
- Last Synced: 2024-10-10T12:45:27.158Z (about 1 month ago)
- Topics: blade, blade-template, crud, laravel, laravel-framework, php, tailwindcss
- Language: PHP
- Homepage:
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Laravel TailwindCSS CRUD
[![Tests](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/run-tests.yml/badge.svg)](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/run-tests.yml)
[![Browser Tests](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/browser-tests.yml/badge.svg)](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/browser-tests.yml)
[![Fix Code Style](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/lint.yml/badge.svg)](https://github.com/phi-rakib/laravel-tailwind-crud/actions/workflows/lint.yml)## Overview
This is a CRUD application built with Laravel and TailwindCSS. It allows users to create, read, update, and delete products.## Features
- Product management (CRUD operations)
- Form validation
- Database seeding
- Feature tests
- Browser tests with Laravel Dusk## Installation
### Prerequisites
- PHP >= 8.2
- Composer
- Node.js & npm### Steps
1. Clone the repository:
```sh
git clone https://github.com/phi-rakib/laravel-tailwind-crud.git
```
2. Navigate to the project directory:
```sh
cd laravel-tailwind-crud
```
3. Install dependencies:
```sh
composer install
npm install
```
4. Copy the `.env.example` file to `.env` and configure your environment variables:
```sh
cp .env.example .env
```
5. Generate an application key:
```sh
php artisan key:generate
```
## ConfigurationUpdate your `.env` file with the necessary configuration for your database and other services.
Example:
```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
```## Database Setup
Run the migrations and seed the database:
```sh
php artisan migrate --seed
```
## Models### Product Model
Located at `app/Models/Product.php`.#### Fields
- `id`: Primary key
- `name`: String
- `description`: Text
- `price`: Decimal
- `created_at`: Timestamp
- `updated_at`: Timestamp## Controllers
### ProductController
Located at `app/Http/Controllers/ProductController.php`.#### Methods
- `index()`: Display a listing of the products.
- `create()`: Show the form for creating a new product.
- `store(Request $request)`: Store a newly created product in the database.
- `show($id)`: Display the specified product.
- `edit($id)`: Show the form for editing the specified product.
- `update(Request $request, $id)`: Update the specified product in the database.
- `destroy($id)`: Remove the specified product from the database.## Routes
Located at `routes/web.php`.
```php
Route::resource('products', ProductController::class);
```## Views
Located in `resources/views/products`.
- `index.blade.php`: Display a listing of the products.
- `create.blade.php`: Show the form for creating a new product.
- `edit.blade.php`: Show the form for editing the specified product.
- `show.blade.php`: Display the specified product.## Testing
### Feature Tests
Located in `tests/Feature`.Run feature tests:
```sh
php artisan test
```### Browser Tests
Located in `tests/Browser`.Run browser tests:
```sh
php artisan dusk
```### Running TailwindCSS
To compile your TailwindCSS assets, run:
```
npm run dev
```
This will watch your CSS and JavaScript files for changes and recompile them automatically.### Running the Server
Start the development server:
```sh
php artisan serve
```### Accessing the Application
Open your web browser and navigate to:
```
http://127.0.0.1:8000/products
```
This will take you to the product index page where you can view the list of products.## Conclusion
This documentation provides an overview of the CRUD application built with Laravel and TailwindCSS. For more detailed information, refer to the source code and the Laravel documentation.