Project by Lukáš Lukča: Database System in Laravel

The motivation for my project is to create a database system for various modules. Tables will be created for the modules in one database. We will try to simplify searching for records.

A software framework is a structure that you can use to build software. It acts as a foundation, so you don't have to deal with creating unnecessary extra logic from scratch. A framework is like a template that you can modify and add in certain features and higher functionalities to create a complex and broad project that many people can use. Software frameworks are typically associated with specific programming languages. Framework is a complete set of libraries that fit together. The advantage is writing clean, safe, and avoiding duplicate code. The time required to develop an application is significantly reduced.

We will create the database using the Laravel framework. PHP is a programming language and Laravel is a PHP framework. Programming in Laravel is object oriented.

Laravel is based on MVC architecture. The application performs 3 basic tasks: logic, control, and output. The logic is represented by Models, control is represented by Controllers and output is represented by Views. Website users send parameters to the controller. Before the user parameters get to the controller, the request must pass through the router. The role of the router is to recognize what users are asking for and call the appropriate controller based on the request. Then, the controller sends the parameters to the model. The application logic is executed in the model. Calculations or database work are performed. From the database, we can choose the data that will be sent to the Model. Then the data from the model are sent to the controller. The processed data are sent to the blade template with the HTML code. Blade is a templating system in which we can use PHP code. The generated view is cached for faster loading. From the view, we send the HTML code to the controller, and the controller HTML website to users.

Figure 1: MVC architecture

Admin can upload Excel files in the project. A model (File), controller (FileController), blade (fileUpload) is created for uploading files. We used the store function from FileController, which was used in the blade form. We created a table with File Name and Select checkboxes in fileUpload. We added a Delete button for each uploaded file. We also added the submit button.

Figure 2: File Upload

To display the records stored in the database, we used the model (Sars), controller (SarsController) and blade (dataTable). Viewing records is important for the admin because of the ability to edit and delete record from the database. If we delete a record from the table, the file will remain in the database. If we want to delete a file, we must go to the FileUpload section of the website and press the delete button.

Figure 3: Table data

In figure 3, we can see the appearance of the website’s Table data section. In the upper right corner is the name of the logged in admin. On the left side there is a sidebar that contains sections Dashboard, File Upload, Table data, Search data for SARS-CoV-2 module. All these sections are visible only to the admin. Users see only the Search data section.

Searching data is a very important part of the application. We used the model (Sars). We have created a controller (SearchController) and a blade (searchSars). In searchSars, we have created a form for selecting data from the database. We designed five search criteria (Country, Sample matrix, Station name, Sample from the year and Data provider). The user can choose one or a maximum of five search criteria. After pressing the Search button, a table with search results will be displayed.

Figure 4: Searching data