Okay, so.., in the dba (database administration) class, we are learning how to create a MariaDB database. Here is the thing though, I am already familiar with MySQL, which is really similar to MariaDB. I hate to say it, but this class is, becuase of this, a bit boring... 😅
Something that is new for me though, is Laravel. I've been wanting to try Laravel for quite a while now. I decided to give myself a challenge and try/learn to create a Laravel API that connects to the MariaDB database that I created in class. 🤔
This is the result of my decision. For now, you can only read from the database. I'm planning on adding the possibility to write to the database later on. ✌️
Note
I'm new to Laravel, so I'm not sure if I'm doing everything right. I'm trying my best though. 🫡
Note
The database and endpoints are in Dutch. Yes I hate it, but this way, it's more in line with the class. 🫠
- Laravel
- MariaDB
- PHP
Caution
I have not tested this using the seeder and migration files. I think it should work, but I'm not sure. I'll test it later, trust me.
- Clone the repository
- Run
composer install
(Copilot suggested this, so I'm doing it. It knows more than me, so...) - Clone
.env.example
and rename it to.env
. Then, fill in the database information in the.env
file.DB_CONNECTION=mysql DB_HOST= DB_PORT= DB_DATABASE= DB_USERNAME= DB_PASSWORD=
- Run
php artisan migrate
to create the database tables RunSEEDING DOES NOT WORK YETphp artisan db:seed
to seed the database- Run
php artisan serve
- 🎉
GET /api
- Kinda like a health endpointGET /api/klanten
- Get all customersGET /api/klanten/{id}
- Get a customer by idGET /api/fabrieken
- Get all factoriesGET /api/fabrieken/{id}
- Get a factory by idGET /api/machines
- Get all machinesGET /api/machines/{id}
- Get a machine by idGET /api/orders
- Get all ordersGET /api/orders/{id}
- Get an order by idGET /api/plannings
- Get all plannings (I have no clue what it is, should probably ask my teacher)GET /api/plannings/{id}
- Get a planning by idGET /api/producten
- Get all productsGET /api/producten/{id}
- Get a product by idGET /api/productielijnen
- Get all production linesGET /api/productielijnen/{id}
- Get a production line by id
For technical issues: Contact me on Discord, or, if you're in my class, just yell my name.
For personal issues: Take a deep breath, it's going to be okay.