This is a simple example of the use of Laravel to implement a registration, edition and removal system of supermarket products organised by location.
The database used is mySql. 2 Tables was used to store products and locations. Products has properties:
- id
- id_location (which relates to locations table)
- name
- description
- timestamps (automatically generated by Laravel)
Locations has propertires:
- id
- aisle
- shelf
- side
- timestamps (automatically generated by Laravel)
There are 2 models:
- Product
- Location That holds its objects properties.
There are 3 screens:
- index
- locations
- create location from where is possible to make all operations over the system.
There are 2 controller:
- ProductController
- LocationController that provides methods for CRUDing items Here are extra methods to get json data for AJAX calls
Each Controller's methods are accessible through its own routes
- /products
- /locations and HTTP methods:
- GET
- POST
- DELETE
An ajax function is called every 2 seconds to retrieve new items from the database in each screen.