Laravel Practice A Laravel application for learning and practicing Laravel framework features and best practices. π Table of Contents
About Features Requirements Installation Configuration Usage Project Structure Testing Contributing License
π― About This project serves as a practical learning environment for exploring Laravel's capabilities, including routing, controllers, models, migrations, authentication, and more. It's designed to help developers understand Laravel concepts through hands-on implementation. β¨ Features
Authentication & Authorization: User registration, login, and role-based access control CRUD Operations: Complete Create, Read, Update, Delete functionality Database Management: Migrations, seeders, and Eloquent ORM API Development: RESTful API endpoints Form Validation: Request validation and error handling File Uploads: Image and document upload functionality Email Integration: Notification and email sending Task Scheduling: Automated task execution Queue Management: Asynchronous job processing
π§ Requirements
PHP >= 8.1 Composer MySQL >= 5.7 or PostgreSQL >= 10 Node.js >= 16.x NPM or Yarn
π¦ Installation
Clone the repository
bash git clone https://github.com/cedkiller/laravelPractice.git cd laravelPractice
Install PHP dependencies
bash composer install
Install JavaScript dependencies
bash npm install
Create environment file
bash cp .env.example .env
Generate application key
bash php artisan key:generate
Configure your database Edit the .env file and set your database credentials:
env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_user DB_PASSWORD=your_database_password
Run database migrations
bash php artisan migrate
Seed the database (optional)
bash php artisan db:seed
Build assets
bash npm run dev
Start the development server
bash php artisan serve
The application will be available at http://localhost:8000
βοΈ Configuration
Mail Configuration
Update your .env file with mail credentials:
envMAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
Queue Configuration
For queue processing, update your .env:
envQUEUE_CONNECTION=database
Run the queue worker:
bashphp artisan queue:work
Storage Link
Create a symbolic link for storage:
bashphp artisan storage:link
π Usage
Running the Application
Development:
bashphp artisan serve
With Vite (for hot reload):
bashnpm run dev
Common Artisan Commands
bash# Clear application cache
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan route:list
php artisan make:controller YourController
php artisan make:model YourModel -m
php artisan migrate
php artisan migrate:rollback π Project Structure laravelPractice/ βββ app/ β βββ Console/ β βββ Exceptions/ β βββ Http/ β β βββ Controllers/ β β βββ Middleware/ β β βββ Requests/ β βββ Models/ β βββ Providers/ βββ bootstrap/ βββ config/ βββ database/ β βββ factories/ β βββ migrations/ β βββ seeders/ βββ public/ βββ resources/ β βββ css/ β βββ js/ β βββ views/ βββ routes/ β βββ api.php β βββ channels.php β βββ console.php β βββ web.php βββ storage/ βββ tests/ β βββ Feature/ β βββ Unit/ βββ .env.example βββ artisan βββ composer.json βββ package.json βββ README.md π§ͺ Testing Run the test suite: bash# Run all tests php artisan test
php artisan test tests/Feature/ExampleTest.php
php artisan test --coverage π€ Contributing Contributions are welcome! Please follow these steps:
Fork the repository Create a new branch (git checkout -b feature/amazing-feature) Commit your changes (git commit -m 'Add some amazing feature') Push to the branch (git push origin feature/amazing-feature) Open a Pull Request
π License This project is open-sourced software licensed under the MIT license. π§ Contact Your Name - @cedkiller Project Link: https://github.com/cedkiller/laravelPractice π Acknowledgments
Laravel Documentation Laravel Bootcamp Laracasts Laravel Community