0% found this document useful (0 votes)
43 views

Laravel INT221 Project

This document outlines the requirements for developing a CRUD application using the Laravel PHP framework. It will allow users to perform basic CRUD operations on a database through an intuitive interface. The application aims to be secure, scalable and customizable.

Uploaded by

Biraj Regmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Laravel INT221 Project

This document outlines the requirements for developing a CRUD application using the Laravel PHP framework. It will allow users to perform basic CRUD operations on a database through an intuitive interface. The application aims to be secure, scalable and customizable.

Uploaded by

Biraj Regmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Laravel CRUD APP

Software Requirements Specification

Operating system: Linux, macOS or Windows


Web server: Apache or Nginx
PHP: PHP 8.0 or higher
Database: MySQL, PostgreSQL or SQLite

Date:1-Nov-23

Submitted To:
Dr. Karthick Panneerselvan

Submitted By:
Sreehari Vinod P
Reg No.12018861
Table of Contents

CLIENT APPROVAL .…………………………………………………………………………… 3


1.INTRODUCTION .…………………………………………………………………………… 4
1.1 PURPOSE .…………………………………………………………………………… 4
1.2 SCOPE .…………………………………………………………………………… 5
1.3 DEFINITIONS,ACRONYMS, AND ABBREVIATIONS …………………………………….. 5
1.4 REFERENCES …………………………………………………………………………… 6
1.5 OVERVIEW …………………………………………………………………………… 6

2. PRODUCT DESCRIPTION ………………………………………………………………. 7


2.1 PRODUCT PERSPECTIVE ………………………………………………………………. 8
2.2 PRODUCT FUNCTIONS. ………………………………………………………………... 8
2.3 USER CHARACTERISTICS ………………………………………………………………. 8
2.4 Specific Requirements and Dependencies ………………………………………………….. 9

3. CODE AND FUNCTIONALITY ………………………………………………………………. 10


3.1 CONTROLLER CODE ……………………………………………………………………… 11
3.2 CONCLUSION ………………………………………………………………………………. 17

2
CLIENTAPPROVAL

PROJECT NAME: Laravel CRUD Application

JOB LOCATION: Phagwara, Punjab

EST. START DATE: 15-OCT-23 EST.FINISH DATE: 31-OCT -23

PROJECT LEADER: KARTHICK PANNEERSELVAN COMPANY: LPU

CONATACT NAME: Mrs. Balbir Meenu PG

PHONE: 9526783999 Lpu, Dakoha, Jalandhar

EMAIL: [email protected]

SUMMARY: This document summarizes the software requirements for a Laravel CRUD
application for a supermarket. The purpose of this application is to provide a generic CRUD
interface for managing any type of data of client. The □
application will be easy to use and extensible,
and it will support common CRUD features such as create, read, update, and delete.

OUTCOME: CRUD app is a web application that allows users to create, read, update, and
delete data in a database. CRUD apps are often used to manage customer data, product data,
inventory data, and other types of data.

ACTION TO COMPLETION: Design and develop the user interface, ensuring that it is
intuitive and user-friendly. Implement the CRUD functionality, ensuring that it is secure,
performant, and scalable. Test the application thoroughly and deploy it to production.

BENEFITS: The application will be secure and will protect user data from unauthorized
access. It will also be performant and will be able to handle many concurrent users. The
application will be extensible and will be easy to customize to meet the specific needs of
different users.

PROJECTED BUDGET: 10,500 – 22,000 (INR)

REQUIREMENTS: Working laptop with any operating system installed, Web server: Apache
or Nginx PHP: PHP 8.0 or higher Database: MySQL, PostgreSQL, or SQLite.

PROPOSAL MAY BE WITHDRAWEN


IF NOT ACCEPTED BY DATE OF: 1-NOV-23

ACCEPTANCE OF PROPOSAL

AUTHORIZED CLIENT DATE OF ACCEPTANCE:


SIGNATURE: 1-Nov-23

3
1. Introduction
A CRUD app is a type of software application that allows users to create, read, update, and
delete data. This is the most basic functionality that any database-driven application needs to
have. CRUD apps are used in a wide variety of industries, including e-commerce, social media,
and customer relationship management (CRM).

CRUD apps are typically made up of three main components:

A database: This is where the data is stored.


A user interface (UI): This is how users interact with the app to create, read, update, and
delete data.
An API: This is a layer of software that sits between the database and the UI. It provides a
standard way for the UI to interact with the database.

Here are some of the benefits of using a CRUD app:

• Improved productivity: CRUD apps can help users to be more productive by


automating tasks such as data entry and updates.
• Reduced errors: CRUD apps can help to reduce errors by providing users with a
consistent and easy-to-use interface for interacting with data.
• Improved data security: CRUD apps can help to improve data security by providing
users with granular control over who can access and modify data.
• Increased scalability: CRUD apps can be scaled to meet the needs of businesses of all
sizes.

1.1 Purpose
Laravel is a popular PHP framework that makes it easy to develop web applications. One of
the core features of Laravel is its support for CRUD operations. CRUD stands for Create,
Read, Update, and Delete. These are the four basic operations that are needed to manage data
in a database.

Laravel provides several features that make it easy to develop CRUD apps, including:

• Eloquent: Eloquent is a powerful object-relational mapping (ORM) library that makes


it easy to interact with databases.
• Migrations: Laravel's migrations feature makes it easy to create and maintain database
tables.
• Seeding: Laravel's seeding feature makes it easy to populate database tables with data.
• Routing: Laravel's routing system makes it easy to define routes for CRUD operations.
• Controllers: Laravel's controllers provide a convenient way to handle CRUD requests.
• Views: Laravel's views provide a way to render HTML templates with data from the
database.

By using Laravel, developers can quickly and easily build CRUD apps without having to
write a lot of boilerplate code.

4
1.2 Scope
The scope of Laravel CRUD is quite broad, and it can be used to develop a wide variety of
web applications, including:

• E-commerce websites
• Content management systems (CMS)
• Customer relationship management (CRM) systems
• Project management systems
• To-do list apps
• Contact manager apps
• Product catalog apps
• Social media websites
• News websites
• Blogs
• Forums
• and more!
Laravel CRUD is a powerful tool that can be used to develop a wide variety of web
applications, and it is a good choice for developers of all skill levels.

Here are some of the benefits of using Laravel CRUD:

• Quick and easy to develop: Laravel CRUD provides several features that make it easy
to develop web applications quickly and easily. For example, Laravel's Eloquent
ORM makes it easy to interact with databases, and Laravel's built-in routing and
controller system makes it easy to define routes for CRUD operations.
• Secure and scalable: Laravel CRUD is designed to be secure and scalable. Laravel's
built-in security features help to protect web applications from common attacks, and
Laravel's architecture makes it easy to scale applications to meet the needs of
growing businesses.
• Flexible and customizable: Laravel CRUD is a flexible and customizable framework.
Laravel provides several hooks and extension points that allow developers to
customize the framework to meet the specific needs of their web applications.
• Large community and support: Laravel has a large and active community of developers
who are always willing to help new users. Laravel also has several resources
available, such as documentation, tutorials, and video courses, that can help
developers learn more about the framework.

1.3 Definitions, Acronyms, and Abbreviations

• CRUD: Create, Read, Update, Delete


• ORM: Object-Relational Mapping
• API: Application Programming Interface
• UI: User Interface
• CMS: Content Management System

5
• CRM: Customer Relationship Management
• PHP: Hypertext Pre-processor
• SQL: Structured Query Language
• REST: Representational State Transfer

1.4 References

1 The official Laravel documentation on CRUD: https://kinsta.com/blog/laravel-crud/


2 A tutorial on CRUD in Laravel using resource controllers:
https://appdividend.com/2022/01/26/laravel-8-crud.
3 A blog post on best practices for Laravel CRUD: https://freelancerviet.net/laravel-api-
crud-best-practice/
4 A package for Laravel CRUD called Laravel-CRUD able:
https://github.com/Flobbos/laravel-crudable/.
5 A video course on Laravel CRUD: https://www.youtube.com/watch?v=QVNQq-LfHBk

1.5 Overview

Laravel CRUD is a good choice for developing a wide variety of web applications, including
e-commerce websites, content management systems, customer relationship management
systems, and project management systems.

• A powerful and flexible framework for developing CRUD applications in Laravel.


• Provides several features that make it easy to develop CRUD applications quickly and
easily.
• Designed to be secure and scalable.
• Allows developers to customize the framework to meet the specific needs of their web
applications.
• A good choice for developing a wide variety of web applications.

6
2. Product Description
Laravel CRUD App for Supermarket

Overview

This Laravel CRUD app is designed to help supermarkets manage their inventory, orders,
and customers. It is a powerful and flexible tool that can be customized to meet the specific
needs of any supermarket.

Features

The Laravel CRUD app for supermarkets includes the following features:

Inventory management: The app allows users to track their inventory levels, add new
products, and edit product information.
Order management: The app allows users to place and manage orders, and to track the
status of orders.
Customer management: The app allows users to create and manage customer accounts, and
to track customer purchase history.

Benefits

The Laravel CRUD app for supermarkets offers several benefits, including:

Increased efficiency: The app can help supermarkets to be more efficient by automating tasks
such as inventory management and order processing.
Reduced errors: The app can help to reduce errors by providing users with a consistent and
easy-to-use interface for managing data.
Improved customer service: The app can help supermarkets to improve customer service by
providing them with a way to track customer purchase history and to place orders on behalf
of customers.

How to Use

The Laravel CRUD app for supermarkets is easy to use. Users can simply log in to the app
and start managing their inventory, orders, and customers. The app provides a user-friendly
interface that makes it easy to add, edit, and delete data.

Customization

The Laravel CRUD app for supermarkets is customizable to meet the specific needs of any
supermarket. Developers can add new features, change the look and feel of the app, and
integrate the app with other systems.

7
Conclusion

The Laravel CRUD app for supermarkets is a powerful and flexible tool that can help
supermarkets to be more efficient, reduce errors, and improve customer service. It is a good
choice for supermarkets of all sizes.

2.1 Product Perspective

Problem: A supermarket needs a way to manage its inventory, products, and sales. The
current system is manual and time-consuming, and it is difficult to track data accurately.

Solution: A Laravel CRUD app can provide a centralized solution for managing all of the
supermarket's data. The app can be used to create, read, update, and delete product
information, inventory levels, and sales data. The app can also be used to generate reports on
inventory levels, sales trends, and other important metrics.

2.2 Product Functions

A Laravel CRUD app for a supermarket can have the following product functions:

Create:
• Create new products with details including product name, description, price, quantity,
category, image, etc.
• Create variations of products with different sizes, colours, flavours, etc.
• Create product bundles and promotions.

Read:
• View a list of all products in the supermarket.
• View the details of a specific product, including its variations and bundles.
• Search for products by name, category, price, etc.
• View the sales history of a product.

Update:
• Update the details of a product, including its name, description, price, quantity,
category, image, etc.
• Update the details of a product variation, such as its size, color, flavor, price, etc.
• Update the details of a product bundle or promotion.
• Update the sales price of a product.

Delete:
• Delete a product from the supermarket.
• Delete a product variation from a product.
• Delete a product bundle or promotion.

The Laravel CRUD app for a supermarket can be customized to meet the specific needs of the
supermarket. For example, the app can be integrated with the supermarket's point-of-sale

8
system to automate the sales process. The app can also be integrated with the supermarket's
loyalty program to allow customers to earn and redeem rewards for their purchases.
2.3 User Characteristics

Access control: The app should provide different access levels for different user groups. For
example, store managers should have access to all the features of the app, while cashiers
should only have access to the features that they need to perform their jobs.
Ease of use: The app should be easy to use and navigate for all users, regardless of their
technical expertise.
Performance: The app should be able to handle many users and transactions simultaneously.
Security: The app should be secure and protect user data from unauthorized access.
Scalability: The app should be able to scale to meet the needs of a growing supermarket.

2.4 Specific Requirements and Dependencies

The specific requirements and dependencies for a Laravel CRUD app will vary depending on
the specific needs of the app. However, there are some general requirements and
dependencies that are common to all Laravel CRUD apps.

Requirements:

Laravel framework
PHP interpreter (version 7.3 or higher)
MySQL database (version 5.7 or higher)
Composer dependency manager

Dependencies:

Eloquent ORM
Laravel routing system
Laravel controller system
Laravel view system

The specific requirements and dependencies for a Laravel CRUD app for a supermarket will
vary depending on the size and complexity of the supermarket.

9
3. Code and Functionality

3.1 Controller Code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
Use App\Models\Product;

class ProductController extends Controller


{
//

public function index() {

return view('products.index',[
'products' => Product::latest()-> paginate(5)]);
}

public function create(){


return view('products.create');
}

public function store(Request $request){

//validate data
$request -> validate([
'name' => 'required',
'description' => 'required',
'image' => 'required|mimes:jpeg,png,jpg,gif|max:10000'
]);

//upload image file


$imageName = time().'.'.$request->image->extension();
$request->image->move(public_path('products'), $imageName);

$product = new Product();


$product -> image = $imageName;
$product ->name = $request->name;
$product ->description = $request->description;

$product ->save();
return back()->withSuccess('Product created successfully!');

10
public function edit($id){

$product = Product::where('id',$id)->first();
return view('products.edit',['product' => $product]);

public function update(Request $request, $id) {

//validate data
$request -> validate([
'name' => 'required',
'description' => 'required',
'image' => 'nullable|mimes:jpeg,png,jpg,gif|max:10000'
]);
$product = Product::where('id',$id)->first();

if(isset($request -> image)){


//upload image file
$imageName = time().'.'.$request->image->extension();
$request->image->move(public_path('products'), $imageName);
$product -> image = $imageName;
}

$product ->name = $request->name;


$product ->description = $request->description;

$product ->save();
return back()->withSuccess('Product updated successfully!');

public function destroy($id){


$product = Product::where ('id', $id)->first();
$product->delete();

return back()->withSuccess('Product deleted successfully!');


}
public function show($id){
$product = Product::where ('id', $id)->first();

return view('products.show',['product' => $product]);


}
}

The crud app uses paginator with minimum value of 5,


The Laravel paginator is a powerful tool for paginating database results. It is easy to use and
provides several features that make it a good choice for paginating a wide variety of data.

11
To use the Laravel paginator, you first need to get the results of your database query. You
can do this using the Eloquent ORM or the Query Builder. Once you have the results of your
query, you can use the paginate () method to paginate the results.

The paginate () method takes two arguments: the number of results to display per page and
the current page number. If the current page number is not specified, the paginator will
assume that the current page is the first page.

App.blade.php
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laravel CRUD With Image</title>

<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script
>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js">
</script>
</head>

<body>

<nav class="navbar navbar-expand-sm bg-dark">


<!-- Links -->

<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link text-light" href="/">Products</a>
</li>

</ul>

</nav>

@if($message = Session::get('success'))
<div class="alert alert-success alert-block">
<strong>{{$message}}</strong>

</div>
@endif

12
@yield('main')

</body>

</html>

Inside the view folder two folders are created named public and layouts, in the layouts code
the code that is reused in the web page is saved under the name app.blade.php

Product Folder
Inside the product folder under the view there is index.blade.php, create.blade.php,
edit.blade.php

Index.balde.php

@extends('layouts.app')

@section('main')
<div class="container">
<div class="text-right">
<a href="products/create" class="btn btn-dark mt-2">New Products</a>
</div>

<table class="table table-hover mt-2">


<thead>
<tr>
<th>Sno.</th>
<th>Name</th>
<th>Image</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($products as $product)
<tr>
<td>{{ $loop->index+1 }}</td>
<td><a href="products/{{ $product->id }}/show" class="text-
dark">{{$product->name}}</a></td>
<td>
<img src="products/{{ $product->image }}" class="rounded-circle"
width="40" height="40" />
<td>
<a href="products/{{ $product->id }}/edit" class="btn btn-dark btn-
sm">Edit</a>

<form method="POST" class ="d-inline" action="products/{{ $product-


>id }}/delete">

13
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</form>
</td>
</td>
</tr>
@endforeach
</tbody>

</table>
{{$products -> links()}}
<!-- Pagination -->
</div>

@endsection

Creat.blade.php
@extends('layouts.app')

@section('main')
<div class="container">
<div class="row justify-content-center">
<div calss="col-sm-8">
<div class="card mt-3 p-3">
<form method="POST" action="/products/store" enctype="multipart/form-
data">
@csrf
<div class="form-group">
<label>Name</label>
<input type="text" name="name" class="form-control"
value="{{old('name')}}">
@if($errors->has('name'))
<span class="text-danger">{{ $errors->first('name') }}</span>
@endif
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" rows="4" name="description"
value="{{old('description')}}"></textarea>
@if($errors->has('description'))
<span class="text-danger">{{ $errors->first('description') }}</span>
@endif
</div>

<div class="form-group">
<label>Image</label>
<input type="file" name="image" class="form-control"
value="{{old('image')}}"/>

14
@if($errors->has('image'))
<span class="text-danger">{{ $errors->first('image') }}</span>
@endif
</div>

<button type="submit" class="btn btn-dark">Submit</button>

</form>
</div>
</div>
</div>
</div>

@endsection

Show.blade.php

@extends ('layouts.app')

@section ('main')

<div class="container">
<div class="row justify-content-center">
<div class="col-sm-8 mt-4">
<div class="card p-4">
<p>Name : <b>{{ $product->name }}</b></p>
<p>Description : <b>{{ $product->description }}</b></p>
<img src="/products/{{ $product->image }}" class="rounded"
width="100%"/>
</div>
</div>
</div>
</div>

@endsection

Edit.blade.php

@extends('layouts.app')

@section('main')
<div class="container">
<div class="row justify-content-center">
<div calss="col-sm-8">
<div class="card mt-3 p-3">
<h3 class="text-muted">Product Edit #{{$product->name}}</h3>

15
<form method="POST" action="/products/{{ $product->id }}/update"
enctype="multipart/form-data">
@csrf
@method ('PUT')
<div class="form-group">
<label>Name</label>
<input type="text" name="name" class="form-control"
value="{{old('name',$product->name)}}">
@if($errors->has('name'))
<span class="text-danger">{{ $errors->first('name') }}</span>
@endif
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" rows="4"
name="description">"{{old('description',$product->description)}}"</textarea>
@if($errors->has('description'))
<span class="text-danger">{{ $errors->first('description') }}</span>
@endif
</div>

<div class="form-group">
<label>Image</label>
<input type="file" name="image" class="form-control"
value="{{old('image')}}"/>
@if($errors->has('image'))
<span class="text-danger">{{ $errors->first('image') }}</span>
@endif
</div>

<button type="submit" class="btn btn-dark">Submit</button>

</form>
</div>
</div>
</div>
</div>

@endsection

16
3.2 Conclusion
A Laravel CRUD app can be a valuable tool for improving the efficiency and profitability of
a supermarket. It can help to streamline the process of managing products, inventory, sales,
and customers.

Here are some of the benefits of using a Laravel CRUD app for a supermarket:

Improved efficiency: A Laravel CRUD app can help to improve the efficiency of supermarket
operations by automating tasks such as product management, inventory tracking, and sales
reporting.
Reduced costs: A Laravel CRUD app can help to reduce the costs of running a supermarket
by automating tasks that would otherwise be performed manually.
Increased sales: A Laravel CRUD app can help to increase sales by providing customers
with a convenient and user-friendly way to browse and purchase products.
Improved customer satisfaction: A Laravel CRUD app can help to improve customer
satisfaction by providing a positive shopping experience.

Overall, a Laravel CRUD app is a good choice for supermarkets of all sizes. It can help to
improve efficiency, reduce costs, increase sales, and improve customer satisfaction.

GitHub Link: https://github.com/sree69/Laravel-CRUD-App

17

You might also like