Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 1.19 KB

File metadata and controls

49 lines (42 loc) · 1.19 KB

Location based Supermarket CRUD

This is a simple example of the use of Laravel to implement a registration, edition and removal system of supermarket products organised by location.

Database integration

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)

Models

There are 2 models:

  • Product
  • Location That holds its objects properties.

Views

There are 3 screens:

  • index
  • locations
  • create location from where is possible to make all operations over the system.

Controllers

There are 2 controller:

  • ProductController
  • LocationController that provides methods for CRUDing items Here are extra methods to get json data for AJAX calls

Routes

Each Controller's methods are accessible through its own routes

  • /products
  • /locations and HTTP methods:
  • GET
  • POST
  • DELETE

Polling

An ajax function is called every 2 seconds to retrieve new items from the database in each screen.