Repository demonstrating MySQL queries in:
- Laravel (migrations, models, query builder, Eloquent)
- Plain PHP examples (PDO) for quick reference
Author: DhananjaySawant
php-laravel-mysql-queries/
├── README.md
├── .gitignore
├── php/
│ ├── db_connection.php
│ ├── 01_basic_queries.php
│ ├── 02_joins.php
│ ├── 03_aggregate.php
│ ├── 04_subqueries.php
│ └── 05_advanced.php
└── laravel/
├── app/
│ ├── Models/
│ │ ├── Employee.php
│ │ └── Project.php
│ └── Repositories/
│ ├── EmployeeRepository.php
│ └── ComplexQueryRepository.php
├── database/
│ └── migrations/
│ ├── 2025_10_30_000000_create_employees_table.php
│ └── 2025_10_30_000001_create_projects_table.php
└── routes/
└── web.php
- Copy the
laravelfolder into a fresh Laravel project (or adapt files into your project). - Run migrations:
php artisan migrate- Visit the example route:
/employees/projects
Open php/db_connection.php and configure credentials, then run the example scripts using PHP CLI or in a PHP server.
If you want, I can:
- Customize the README with your GitHub username or project description.
- Add seeders / factories for Laravel.
- Create a GitHub repo and push it (I'll give you instructions / commands).