This commit is contained in:
louiscklaw
2025-02-01 02:05:11 +08:00
commit 8b32f90f5f
8154 changed files with 1149767 additions and 0 deletions

179
task1/project/.gitignore vendored Normal file
View File

@@ -0,0 +1,179 @@
**/*.7z
**/vm
**/*.del
**/*.zip
# Created by https://www.toptal.com/developers/gitignore/api/composer,laravel,node
# Edit at https://www.toptal.com/developers/gitignore?templates=composer,laravel,node
### Composer ###
composer.phar
**/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
### Laravel ###
node_modules/
npm-debug.log
yarn-error.log
# Laravel 4 specific
bootstrap/compiled.php
app/storage/
# Laravel 5 & Lumen specific
public/storage
public/hot
# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot
storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
# End of https://www.toptal.com/developers/gitignore/api/composer,laravel,node

View File

@@ -0,0 +1,8 @@
- Develop a system with 10 Database Table
- using GitHub
- using Cloud9
- at least 40 pages of Final Report

Binary file not shown.

Binary file not shown.

Binary file not shown.

36
task1/project/NOTES.md Normal file
View File

@@ -0,0 +1,36 @@
```bash
# start vm and ssh into vm
# username fedora, password 123456
# start docker first
$ cd src
$ ./dc_up.sh
# cwd /app
# after docker started
$ ./setup/9999_done.sh
# in case you need to rebuild scss, to turn on scss building
# on host machine
$ cd /app/example-app
$ npm i -D
$ npm run watch:dev
```
# TODO
[x] login screen remove Argin dashboard 2 laravel 1
1. remove headbar
1. check add resources page
1. should not delete the first row
1. rename aria-label="Default select example"
### email template
resources/views/vendor/mail
### email content
src\php74-httpd\example-app\app\Notifications\ForgotPassword.php

View File

@@ -0,0 +1,429 @@
# Database design (ERD) and metadata
![](./erd.svg)
--------------------------------------------------------------------------------
# Tables
## tbl_addresses
```php
Schema::create('tbl_brands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_brands
```php
Schema::create('tbl_brands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_categories
```php
Schema::create('tbl_categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_items
```php
Schema::create('tbl_items', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_orders
```php
Schema::create('tbl_orders', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->string('status')->default('pending');
});
```
field | description
----------- | ---------------------
id | id of orders
name | name of orders
description | description of orders
status | status of orders
## tbl_projects
```php
Schema::create('tbl_projects', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | -----------------------
id | id of projects
name | name of projects
description | description of projects
## tbl_user_groups
```php
Schema::create('tbl_user_groups', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | --------------------------
id | id of user_groups
name | name of user_groups
description | description of user_groups
## tbl_user_roles
```php
Schema::create('tbl_user_roles', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | -------------------------
id | id of user_roles
name | name of user_roles
description | description of user_roles
## users
```php
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username');
$table->string('firstname')->nullable();
$table->string('lastname')->nullable();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('address')->nullable();
$table->string('city')->nullable();
$table->string('country')->nullable();
$table->string('postal')->nullable();
$table->integer('status')->default(1);
$table->integer('groups')->default();
$table->integer('roles')->default(5);
$table->text('about')->nullable();
$table->rememberToken();
$table->timestamps();
});
```
field | description
----------------- | -------------------------------------------------------------
username | username of user
firstname | first name of user
lastname | last name of user
email | email of user
email_verified_at | email verification time of user
password | salted passdword of usera
address | address of user
city | city of user
country | country of user
postal | postal of user
status | status of user
groups | groups of user
roles | roles of user, default to `Guest` (ref: to `tbl_user_groups`)
about | about of user
# relation tables (many-to-many table)
## rel_address_item.php
```php
Schema::create('rel_address_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('address_id');
$table
->foreign('address_id')
->references('id')
->on('tbl_addresses')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
---------- | ------------------------------------
item_id | id of items (ref: tbl_items->id)
address_id | id of items (ref: tbl_addresses->id)
## rel_brand_item.php
```php
Schema::create('rel_brand_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('brand_id');
$table
->foreign('brand_id')
->references('id')
->on('tbl_brands')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
-------- | ----------------------------------
item_id | id of items (ref: tbl_items->id)
brand_id | id of brands (ref: tbl_brands->id)
## rel_category_item.php
```php
Schema::create('rel_category_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('category_id');
$table
->foreign('category_id')
->references('id')
->on('tbl_categories')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
------------- | ------------------------------------------
item_id | id of items (ref: tbl_items->id)
categories_id | id of categories (ref: tbl_categories->id)
## rel_order_owner.php
```php
Schema::create('rel_order_owner', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('order_id');
$table
->foreign('order_id')
->references('id')
->on('tbl_orders')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
-------- | ---------------------------------
order_id | id of items (ref: tbl_orders->id)
user_id | id of categories (ref: users->id)
## rel_order_project.php
```php
Schema::create('rel_order_project', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('project_id');
$table
->foreign('project_id')
->references('id')
->on('tbl_projects')
->onDelete('cascade');
$table->unsignedBigInteger('order_id');
$table
->foreign('order_id')
->references('id')
->on('tbl_orders')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
---------- | -------------------------------------
project_id | id of project (ref: tbl_projects->id)
order_id | id of order (ref: tbl_orders->id)
## rel_project_owner.php
```php
Schema::create('rel_project_owner', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('project_id');
$table
->foreign('project_id')
->references('id')
->on('tbl_projects')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
---------- | -------------------------------------
project_id | id of project (ref: tbl_projects->id)
order_id | id of order (ref: tbl_orders->id)
## rel_user_item.php
```php
Schema::create('rel_user_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
------- | -------------------------------
item_id | id of item (ref: tbl_items->id)
user_id | id of user (ref: users->id)
## rel_user_user_group.php
```php
Schema::create('rel_user_user_group', function (Blueprint $table) {
$table->id();
$table->timestamps();
// default to guest
$table->unsignedBigInteger('user_group_id');
$table
->foreign('user_group_id')
->references('id')
->on('tbl_user_groups')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
------------- | -------------------------------------------
user_group_id | id of user_group (ref: tbl_user_groups->id)
user_id | id of users (ref: users->id)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1018 KiB

View File

@@ -0,0 +1,114 @@
## Final Report
### Cover
Please refer to cover template
### Abstract
One or two paragraph(s) to show the objectives of the project and the final report.
### Acknowledgement
Thank those who have helped in conducting the project
### Table of Contents
You must use automatic tool to create this, e.g. “Table of Contents” in MS Word
### Introduction
It should be exceed more than one page, including
1. Project title
1. General descriptions of the project objectives
1. General descriptions of the project results
1. Document structure with chapter titles
### Project Background and Problem Analysis
1. Scope of the problem
1. Problem Statements and description
### Proposed Solution
1. Scope of the proposed solution
1. Architecture of the proposed system and roles of hardwares
1. Advantages and drawbacks of the solution
1. block diagram
![](./simple_block.png)
### Requirements
1. Roles of users
1. Functional Requirements
1. Non-functional Requirements:
E.g. Reliability requirements, performance requirements, existing data interface and hardware environment, future extensions of the proposed solution, required implementation language.
### Documentation for Problem Analysis
1. Use Case Diagrams
They should map to your requirements in the previous chapters
1. Fully Dressed Use Cases
### Documentation for Detailed Design
1. Database design (ERD) and metadata
- ![](./erd.svg)
[erd.md](./erd.md)
1. System design (Data Flow Diagram, Class Diagram, etc.)
1. User interface design
- ![](./page_hierarchy.svg)
### Implementation
1. Test plans and results
1. Changes to design and justification of changes (if any)
### Results and conclusions
1. Summary and critical discussion of the results
1. Limitations of the final products / solutions
- no access control at this stage.
- no pagination at this stage
- if a lot of items it will congest in the same page.
- mail server setup for demo purpose.
- single language only
1. Problems/difficulties encountered
- need to familiar with the framework used (e.g. laravel orm...)
- feasibility study of the theme with framework used (e.g. laravel, scss..)
- need tryout docker concept
1. Delays/changes in project schedule
1. Suggestion of further improvements / development
- include more item.
- multilingual...
### References
- [docker documentation](https://docs.docker.com/)
- [laravel 10.x documentation](https://laravel.com/docs/10.x/readme)
- [github/mailhog](https://github.com/mailhog/MailHog)
- [mysql documentation](https://dev.mysql.com/doc/)
- [phpmyadmin documentation](https://www.phpmyadmin.net/docs/)
- [creativetim argon dashboard documentation](https://argon-dashboard-laravel.creative-tim.com/docs/bootstrap/overview/argon-dashboard/index.html)
### Appendices
-

View File

@@ -0,0 +1,59 @@
graph LR;
A(/dashboard)-->B(/profile);
A-->C(/items);
C-->C1(/create)
C-->C2(/view)
C-->C3(/edit)
C-->C4(/delete)
A-->D(/orders)
D-->D1(/create)
D-->D2(/view)
D-->D3(/edit)
D-->D4(/delete)
A-->E(/projects)
E-->E1(/create)
E-->E2(/view)
E-->E3(/edit)
E-->E4(/delete)
A-->F(/users)
F-->F1(/create)
F-->F2(/view)
F-->F3(/edit)
F-->F4(/delete)
A-->G(/user_roles)
G-->G1(/create)
G-->G2(/view)
G-->G3(/edit)
G-->G4(/delete)
A-->H(/user_groups)
H-->H1(/create)
H-->H2(/view)
H-->H3(/edit)
H-->H4(/delete)
A-->I(/addresses)
I-->I1(/create)
I-->I2(/view)
I-->I3(/edit)
I-->I4(/delete)
A-->J(/categories)
J-->J1(/create)
J-->J2(/view)
J-->J3(/edit)
J-->J4(/delete)
A-->K(/brands)
K-->K1(/create)
K-->K2(/view)
K-->K3(/edit)
K-->K4(/delete)
A-->L(/logouts)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -0,0 +1,86 @@
<mxfile host="65bd71144e">
<diagram id="sFCz8x-gxcecHwNoj5ea" name="Page-1">
<mxGraphModel dx="1060" dy="992" grid="1" gridSize="2" guides="0" tooltips="1" connect="0" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="18" value="System block diagram" style="rounded=0;whiteSpace=wrap;html=1;verticalAlign=bottom;fontSize=16;strokeColor=none;" vertex="1" parent="1">
<mxGeometry x="184" y="6" width="614" height="596" as="geometry"/>
</mxCell>
<mxCell id="2" value="docker" style="rounded=1;whiteSpace=wrap;html=1;verticalAlign=bottom;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;connectable=0;" parent="1" vertex="1">
<mxGeometry x="248" y="52" width="484" height="276" as="geometry"/>
</mxCell>
<mxCell id="3" value="laravel(php)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="248" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="4" value="mariaDB(mysql)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="92" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="5" value="web client" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="410" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="6" value="phpmyadmin&lt;br&gt;(db explorer)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="586" y="246" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="7" value="mailhog&lt;br&gt;(dump mail server for test)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="268" y="248" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="8" value="browse" style="endArrow=classic;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="5">
<mxGeometry x="0.1765" y="21" width="50" height="50" relative="1" as="geometry">
<mxPoint x="500" y="410" as="sourcePoint"/>
<mxPoint x="410" y="380" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="12" value="browse" style="endArrow=classic;html=1;exitX=0.44;exitY=0.987;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;entryX=0.288;entryY=-0.01;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="7" target="5">
<mxGeometry x="-0.0227" y="-7" width="50" height="50" relative="1" as="geometry">
<mxPoint x="302" y="396" as="sourcePoint"/>
<mxPoint x="352" y="346" as="targetPoint"/>
<Array as="points">
<mxPoint x="321" y="380"/>
<mxPoint x="462" y="380"/>
</Array>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="13" value="write" style="endArrow=classic;html=1;exitX=0.702;exitY=-0.022;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.703;entryY=0.979;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="3" target="4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="462" y="260" as="sourcePoint"/>
<mxPoint x="512" y="210" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="14" value="read" style="endArrow=classic;html=1;exitX=0.396;exitY=1.023;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.395;entryY=-0.012;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="4" target="3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="520" y="254" as="sourcePoint"/>
<mxPoint x="570" y="204" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="15" value="write" style="endArrow=classic;html=1;edgeStyle=orthogonalEdgeStyle;exitX=0.639;exitY=0.012;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1.006;entryY=0.323;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="6" target="4">
<mxGeometry x="-0.2257" width="50" height="50" relative="1" as="geometry">
<mxPoint x="680" y="184" as="sourcePoint"/>
<mxPoint x="632" y="100" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="16" value="read" style="endArrow=classic;html=1;entryX=0.332;entryY=0.023;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1.007;exitY=0.607;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="4" target="6">
<mxGeometry x="0.0289" width="50" height="50" relative="1" as="geometry">
<mxPoint x="594" y="194.00000000000023" as="sourcePoint"/>
<mxPoint x="644" y="144.00000000000023" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="17" value="browse" style="endArrow=classic;html=1;exitX=0.497;exitY=0.979;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="6">
<mxGeometry x="0.0118" y="10" width="50" height="50" relative="1" as="geometry">
<mxPoint x="604" y="348.02000000000004" as="sourcePoint"/>
<mxPoint x="506" y="408" as="targetPoint"/>
<Array as="points">
<mxPoint x="646" y="378"/>
<mxPoint x="506" y="378"/>
</Array>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

BIN
task1/project/_doc_source/Final_Report/simple_block.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,29 @@
# Installation_Deployment_Guide
## Requirement
- linux (preferrable fedora)
- [docker](https://docs.docker.com/)
- [docker compose](https://docs.docker.com/compose/)
- [docker hub](https://hub.docker.com/)
- [mysql](https://hub.docker.com/_/mysql)
- [phpmyadmin](https://hub.docker.com/_/phpmyadmin)
- [mailhog](https://github.com/mailhog/MailHog)
## to start
1. start vm
- username: fedora
- password: 123456
2. inside vm
```bash
# start docker, configuration defined by docker-compose.yml
$ cd src
$ ./dc_up.sh
# after docker started
$ ./setup/9999_done.sh
```

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,142 @@
# Documents and final products in soft copies
## Preliminary Study (original submitted version)
## Initial Report (original submitted version)
## Interim Report (original submitted version)
## Final Report
## Source code and applications (e.g. apk file)
## Installation / Deployment Guide
## User Guide
## Presentation slides
## Peer Review (per each member)
## Critical Evaluation (per each member)
# Hard-copy documents
---
## Final Report
### Cover
Please refer to cover template
### Abstract
One or two paragraph(s) to show the objectives of the project and the final report.
### Acknowledgement
Thank those who have helped in conducting the project
### Table of Contents
You must use automatic tool to create this, e.g. “Table of Contents” in MS Word
### Introduction
It should be exceed more than one page, including
1. Project title
1. General descriptions of the project objectives
1. General descriptions of the project results
1. Document structure with chapter titles
### Project Background and Problem Analysis
1. Scope of the problem
1. Problem Statements and description
### Proposed Solution
1. Scope of the proposed solution
1. Architecture of the proposed system and roles of hardwares
1. Advantages and drawbacks of the solution
### Requirements
1. Roles of users
1. Functional Requirements
1. Non-functional Requirements:
E.g. Reliability requirements, performance requirements, existing data interface and hardware environment, future extensions of the proposed solution, required implementation language.
### Documentation for Problem Analysis
1. Use Case Diagrams
They should map to your requirements in the previous chapters
1. Fully Dressed Use Cases
### Documentation for Detailed Design
1. Database design (ERD) and metadata
- ![](./erd.svg)
[erd.md](./erd.md)
1. System design (Data Flow Diagram, Class Diagram, etc.)
1. User interface design
- ![](./page_hierarchy.svg)
### Implementation
1. Test plans and results
1. Changes to design and justification of changes (if any)
### Results and conclusions
1. Summary and critical discussion of the results
1. Limitations of the final products / solutions
- no access control at this stage.
- no pagination at this stage
- if a lot of items it will congest in the same page.
- mail server setup for demo purpose.
- single language only
1. Problems/difficulties encountered
- need to familiar with the framework used (e.g. laravel orm...)
- feasibility study of the theme with framework used (e.g. laravel, scss..)
- need tryout docker concept
1. Delays/changes in project schedule
1. Suggestion of further improvements / development
- include more item.
- multilingual...
### References
- [docker documentation](https://docs.docker.com/)
- [laravel 10.x documentation](https://laravel.com/docs/10.x/readme)
- [github/mailhog](https://github.com/mailhog/MailHog)
- [mysql documentation](https://dev.mysql.com/doc/)
- [phpmyadmin documentation](https://www.phpmyadmin.net/docs/)
- [creativetim argon dashboard documentation](https://argon-dashboard-laravel.creative-tim.com/docs/bootstrap/overview/argon-dashboard/index.html)
### Appendices
-
## User Guide

View File

@@ -0,0 +1,58 @@
# User Guide
## page hierarchy
![](./page_hierarchy.svg)
## login
![](./screenshot/login.png)
## dashboard
![](./screenshot/dashboard.png)
## profile
![](./screenshot/profile.png)
## items_list
![](./screenshot/items_list.png)
## items_view
![](./screenshot/items_view.png)
## items_edit
![](./screenshot/items_edit.png)
## orders_list
![](./screenshot/orders_list.png)
## projects_list
![](./screenshot/projects_list.png)
## user_list
![](./screenshot/user_list.png)
## user_roles_list
![](./screenshot/user_roles_list.png)
## users_groups_list
![](./screenshot/users_groups_list.png)
<!-- show user how to gen -->
![](./screenshot/addresses_list.png)
![](./screenshot/categories_list.png)
![](./screenshot/brands_list.png)

View File

@@ -0,0 +1,59 @@
graph LR;
A(/dashboard)-->B(/profile);
A-->C(/items);
C-->C1(/create)
C-->C2(/view)
C-->C3(/edit)
C-->C4(/delete)
A-->D(/orders)
D-->D1(/create)
D-->D2(/view)
D-->D3(/edit)
D-->D4(/delete)
A-->E(/projects)
E-->E1(/create)
E-->E2(/view)
E-->E3(/edit)
E-->E4(/delete)
A-->F(/users)
F-->F1(/create)
F-->F2(/view)
F-->F3(/edit)
F-->F4(/delete)
A-->G(/user_roles)
G-->G1(/create)
G-->G2(/view)
G-->G3(/edit)
G-->G4(/delete)
A-->H(/user_groups)
H-->H1(/create)
H-->H2(/view)
H-->H3(/edit)
H-->H4(/delete)
A-->I(/addresses)
I-->I1(/create)
I-->I2(/view)
I-->I3(/edit)
I-->I4(/delete)
A-->J(/categories)
J-->J1(/create)
J-->J2(/view)
J-->J3(/edit)
J-->J4(/delete)
A-->K(/brands)
K-->K1(/create)
K-->K2(/view)
K-->K3(/edit)
K-->K4(/delete)
A-->L(/logouts)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
task1/project/_doc_source/User Guide/screenshot/login.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
task1/project/_doc_source/User Guide/screenshot/profile.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
mmdc -i page_hierarchy.mmd -o page_hierarchy.svg

View File

@@ -0,0 +1,429 @@
# Database design (ERD) and metadata
![](./erd.svg)
--------------------------------------------------------------------------------
# Tables
## tbl_addresses
```php
Schema::create('tbl_brands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_brands
```php
Schema::create('tbl_brands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_categories
```php
Schema::create('tbl_categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_items
```php
Schema::create('tbl_items', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | ---------------------
id | id of brands
name | name of brands
description | description of brands
## tbl_orders
```php
Schema::create('tbl_orders', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->string('status')->default('pending');
});
```
field | description
----------- | ---------------------
id | id of orders
name | name of orders
description | description of orders
status | status of orders
## tbl_projects
```php
Schema::create('tbl_projects', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | -----------------------
id | id of projects
name | name of projects
description | description of projects
## tbl_user_groups
```php
Schema::create('tbl_user_groups', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | --------------------------
id | id of user_groups
name | name of user_groups
description | description of user_groups
## tbl_user_roles
```php
Schema::create('tbl_user_roles', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->nullable();
$table->text('description')->nullable();
});
```
field | description
----------- | -------------------------
id | id of user_roles
name | name of user_roles
description | description of user_roles
## users
```php
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username');
$table->string('firstname')->nullable();
$table->string('lastname')->nullable();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('address')->nullable();
$table->string('city')->nullable();
$table->string('country')->nullable();
$table->string('postal')->nullable();
$table->integer('status')->default(1);
$table->integer('groups')->default();
$table->integer('roles')->default(5);
$table->text('about')->nullable();
$table->rememberToken();
$table->timestamps();
});
```
field | description
----------------- | -------------------------------------------------------------
username | username of user
firstname | first name of user
lastname | last name of user
email | email of user
email_verified_at | email verification time of user
password | salted passdword of usera
address | address of user
city | city of user
country | country of user
postal | postal of user
status | status of user
groups | groups of user
roles | roles of user, default to `Guest` (ref: to `tbl_user_groups`)
about | about of user
# relation tables (many-to-many table)
## rel_address_item.php
```php
Schema::create('rel_address_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('address_id');
$table
->foreign('address_id')
->references('id')
->on('tbl_addresses')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
---------- | ------------------------------------
item_id | id of items (ref: tbl_items->id)
address_id | id of items (ref: tbl_addresses->id)
## rel_brand_item.php
```php
Schema::create('rel_brand_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('brand_id');
$table
->foreign('brand_id')
->references('id')
->on('tbl_brands')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
-------- | ----------------------------------
item_id | id of items (ref: tbl_items->id)
brand_id | id of brands (ref: tbl_brands->id)
## rel_category_item.php
```php
Schema::create('rel_category_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('category_id');
$table
->foreign('category_id')
->references('id')
->on('tbl_categories')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
------------- | ------------------------------------------
item_id | id of items (ref: tbl_items->id)
categories_id | id of categories (ref: tbl_categories->id)
## rel_order_owner.php
```php
Schema::create('rel_order_owner', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('order_id');
$table
->foreign('order_id')
->references('id')
->on('tbl_orders')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
-------- | ---------------------------------
order_id | id of items (ref: tbl_orders->id)
user_id | id of categories (ref: users->id)
## rel_order_project.php
```php
Schema::create('rel_order_project', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('project_id');
$table
->foreign('project_id')
->references('id')
->on('tbl_projects')
->onDelete('cascade');
$table->unsignedBigInteger('order_id');
$table
->foreign('order_id')
->references('id')
->on('tbl_orders')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
---------- | -------------------------------------
project_id | id of project (ref: tbl_projects->id)
order_id | id of order (ref: tbl_orders->id)
## rel_project_owner.php
```php
Schema::create('rel_project_owner', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('project_id');
$table
->foreign('project_id')
->references('id')
->on('tbl_projects')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
---------- | -------------------------------------
project_id | id of project (ref: tbl_projects->id)
order_id | id of order (ref: tbl_orders->id)
## rel_user_item.php
```php
Schema::create('rel_user_item', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('item_id');
$table
->foreign('item_id')
->references('id')
->on('tbl_items')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->timestamps();
});
```
field | description
------- | -------------------------------
item_id | id of item (ref: tbl_items->id)
user_id | id of user (ref: users->id)
## rel_user_user_group.php
```php
Schema::create('rel_user_user_group', function (Blueprint $table) {
$table->id();
$table->timestamps();
// default to guest
$table->unsignedBigInteger('user_group_id');
$table
->foreign('user_group_id')
->references('id')
->on('tbl_user_groups')
->onDelete('cascade');
$table->unsignedBigInteger('user_id');
$table
->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
```
field | description
------------- | -------------------------------------------
user_group_id | id of user_group (ref: tbl_user_groups->id)
user_id | id of users (ref: users->id)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1018 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,2 @@
## User Guide

View File

@@ -0,0 +1,59 @@
graph LR;
A(/dashboard)-->B(/profile);
A-->C(/items);
C-->C1(/create)
C-->C2(/view)
C-->C3(/edit)
C-->C4(/delete)
A-->D(/orders)
D-->D1(/create)
D-->D2(/view)
D-->D3(/edit)
D-->D4(/delete)
A-->E(/projects)
E-->E1(/create)
E-->E2(/view)
E-->E3(/edit)
E-->E4(/delete)
A-->F(/users)
F-->F1(/create)
F-->F2(/view)
F-->F3(/edit)
F-->F4(/delete)
A-->G(/user_roles)
G-->G1(/create)
G-->G2(/view)
G-->G3(/edit)
G-->G4(/delete)
A-->H(/user_groups)
H-->H1(/create)
H-->H2(/view)
H-->H3(/edit)
H-->H4(/delete)
A-->I(/addresses)
I-->I1(/create)
I-->I2(/view)
I-->I3(/edit)
I-->I4(/delete)
A-->J(/categories)
J-->J1(/create)
J-->J2(/view)
J-->J3(/edit)
J-->J4(/delete)
A-->K(/brands)
K-->K1(/create)
K-->K2(/view)
K-->K3(/edit)
K-->K4(/delete)
A-->L(/logouts)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -0,0 +1,91 @@
tbl_warehouse_items {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_purchase_orders {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_deliveries {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_discounts {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_invoices {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_order_items {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_payments {
int id
int quantity
string productCode
float pricePerUnit
}
tbl_returns {
int id
int quantity
string productCode
float pricePerUnit
}
---
```mermaid
erDiagram
CUSTOMER ||--o{ ORDER : places
CUSTOMER {
string name
string custNumber
string sector
}
ORDER ||--|{ LINE-ITEM : contains
ORDER {
int orderNumber
string deliveryAddress
}
LINE-ITEM {
int id
int quantity
string productCode
float pricePerUnit
}
```

View File

@@ -0,0 +1,52 @@
tbl_brands
generate 30 computer manufacturer brand name and descriptions,
i want it in laravel seeder format,
insert into tbl_brands
show me the SQL only
generate 30 chinese computer manufacturer brand name and descriptions,
i want it in laravel seeder format,
insert into tbl_brands
show me the SQL only
tbl_category
generate 30 example computer name and descriptions,
i want it in laravel seeder format,
insert into tbl_categories
tbl_item
generate 30 example computer name and descriptions,
i want it in laravel seeder format,
insert into tbl_items
tbl_order
generate 30 example name and descriptions,
i want it in laravel seeder format,
insert into tbl_order
tbl_address
generate 30 example name and descriptions,
i want it in laravel seeder format,
insert into tbl_address
show me the SQL only
tbl_projects
generate 30 example project name and descriptions,
i want it in laravel seeder format,
insert into tbl_projects
show me the SQL only
tbl_user_roles
generate 30 example user group name and descriptions,
i want it in laravel seeder format,
insert into tbl_user_roles
show me the SQL only
tbl_user_group
generate 30 example user group name and descriptions,
i want it in laravel seeder format,
insert into tbl_user_groups
show me the SQL only

View File

@@ -0,0 +1,86 @@
<mxfile host="65bd71144e">
<diagram id="sFCz8x-gxcecHwNoj5ea" name="Page-1">
<mxGraphModel dx="1060" dy="992" grid="1" gridSize="2" guides="0" tooltips="1" connect="0" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="18" value="System block diagram" style="rounded=0;whiteSpace=wrap;html=1;verticalAlign=bottom;fontSize=16;strokeColor=none;" vertex="1" parent="1">
<mxGeometry x="184" y="6" width="614" height="596" as="geometry"/>
</mxCell>
<mxCell id="2" value="docker" style="rounded=1;whiteSpace=wrap;html=1;verticalAlign=bottom;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;connectable=0;" parent="1" vertex="1">
<mxGeometry x="248" y="52" width="484" height="276" as="geometry"/>
</mxCell>
<mxCell id="3" value="laravel(php)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="248" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="4" value="mariaDB(mysql)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="92" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="5" value="web client" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="427.5" y="410" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="6" value="phpmyadmin&lt;br&gt;(db explorer)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="586" y="246" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="7" value="mailhog&lt;br&gt;(dump mail server for test)" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="268" y="248" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="8" value="browse" style="endArrow=classic;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="5">
<mxGeometry x="0.1765" y="21" width="50" height="50" relative="1" as="geometry">
<mxPoint x="500" y="410" as="sourcePoint"/>
<mxPoint x="410" y="380" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="12" value="browse" style="endArrow=classic;html=1;exitX=0.44;exitY=0.987;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;entryX=0.288;entryY=-0.01;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="7" target="5">
<mxGeometry x="-0.0227" y="-7" width="50" height="50" relative="1" as="geometry">
<mxPoint x="302" y="396" as="sourcePoint"/>
<mxPoint x="352" y="346" as="targetPoint"/>
<Array as="points">
<mxPoint x="321" y="380"/>
<mxPoint x="462" y="380"/>
</Array>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="13" value="write" style="endArrow=classic;html=1;exitX=0.702;exitY=-0.022;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.703;entryY=0.979;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="3" target="4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="462" y="260" as="sourcePoint"/>
<mxPoint x="512" y="210" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="14" value="read" style="endArrow=classic;html=1;exitX=0.396;exitY=1.023;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.395;entryY=-0.012;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="4" target="3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="520" y="254" as="sourcePoint"/>
<mxPoint x="570" y="204" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="15" value="write" style="endArrow=classic;html=1;edgeStyle=orthogonalEdgeStyle;exitX=0.639;exitY=0.012;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1.006;entryY=0.323;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="6" target="4">
<mxGeometry x="-0.2257" width="50" height="50" relative="1" as="geometry">
<mxPoint x="680" y="184" as="sourcePoint"/>
<mxPoint x="632" y="100" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="16" value="read" style="endArrow=classic;html=1;entryX=0.332;entryY=0.023;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1.007;exitY=0.607;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="4" target="6">
<mxGeometry x="0.0289" width="50" height="50" relative="1" as="geometry">
<mxPoint x="594" y="194.00000000000023" as="sourcePoint"/>
<mxPoint x="644" y="144.00000000000023" as="targetPoint"/>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="17" value="browse" style="endArrow=classic;html=1;exitX=0.497;exitY=0.979;exitDx=0;exitDy=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="6">
<mxGeometry x="0.0118" y="10" width="50" height="50" relative="1" as="geometry">
<mxPoint x="604" y="348.02000000000004" as="sourcePoint"/>
<mxPoint x="506" y="408" as="targetPoint"/>
<Array as="points">
<mxPoint x="646" y="378"/>
<mxPoint x="506" y="378"/>
</Array>
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

BIN
task1/project/_doc_source/simple_block.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,10 @@
tbl_brand
tbl_category
tbl_product
tbl_item
tbl_order
tbl_address
tbl_projects
tbl_user
tbl_user_role
tbl_user_group

Binary file not shown.

21
task1/project/bs_init.js Normal file
View File

@@ -0,0 +1,21 @@
/**
* Require Browsersync
*/
var browserSync = require("browser-sync");
/**
* Run Browsersync with server config
*/
browserSync({
watch: true,
watchOptions: {
ignoreInitial: true,
ignored: "*.txt",
},
files: ["src/**/*.php", "src/**/*.css", "app/*.html", "app/css/*.css"],
watchEvents: ["add", "change", "unlink", "addDir", "unlinkDir"],
reloadDelay: 10,
// Using a localhost address with a port
proxy: "localhost:8000",
});

BIN
task1/project/course_code.png (Stored with Git LFS) Normal file

Binary file not shown.

2534
task1/project/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
{
"name": "ryankochun91735",
"version": "1.0.0",
"description": "",
"scripts": {
"watch:dev": "node bs_init.js",
"test": "echo \"Error: no test specified\" && exit 1",
"gitUpdate": "git add . && git commit -m\"update ryankochun91735,\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"browser-sync": "^3.0.2"
}
}

32
task1/project/src/.gitignore vendored Normal file
View File

@@ -0,0 +1,32 @@
**/*.del
# Created by https://www.toptal.com/developers/gitignore/api/laravel
# Edit at https://www.toptal.com/developers/gitignore?templates=laravel
### Laravel ###
/vendor/
node_modules/
npm-debug.log
yarn-error.log
# Laravel 4 specific
bootstrap/compiled.php
app/storage/
# Laravel 5 & Lumen specific
public/storage
public/hot
# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot
storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
# End of https://www.toptal.com/developers/gitignore/api/laravel

View File

@@ -0,0 +1,7 @@
@REM # docker compose kill
@REM # docker compose down
docker compose up -d --build
@REM # docker compose logs -f
docker compose exec -it php74-httpd bash

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -x
# docker compose kill
# docker compose down
docker compose up -d --build
# docker compose logs -f
docker compose exec -it php74-httpd bash

View File

@@ -0,0 +1,48 @@
volumes:
php74_vendor:
services:
mysql:
image: mysql:latest
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: laravel
MYSQL_USER: project
MYSQL_PASSWORD: project
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8089:80
environment:
PMA_HOST: mysql
PMA_USER: project
PMA_PASSWORD: project
UPLOAD_LIMIT: 10G
MAX_EXECUTION_TIME: 1800
depends_on:
- mysql
mailhog:
image: mailhog/mailhog:latest
ports:
- 1025:1025
- 8025:8025
php74-httpd:
# image: composer
build: php74-httpd
ports:
- 8000:8000
- 5173:5173
volumes:
- php74_vendor:/app/vendor
- ./php74-httpd:/app
- ./php74-httpd/php-cli.ini:/usr/local/etc/php/conf.d/php-cli.ini
working_dir: /app
user: 1000:1000
command: sleep infinity
depends_on:
- mysql

View File

@@ -0,0 +1,81 @@
FROM composer
RUN docker-php-ext-install \
mysqli \
pdo \
pdo_mysql
RUN docker-php-ext-enable \
pdo_mysql
RUN apk update
RUN apk add entr tmux
RUN apk add nodejs npm
RUN mkdir /.npm
RUN chown -R 1000:1000 "/.npm"
# bcmath
# bz2
# calendar
# ctype
# curl
# dba
# dl_test
# dom
# enchant
# exif
# ffi
# fileinfo
# filter
# ftp
# gd
# gettext
# gmp
# hash
# iconv
# imap
# intl
# json
# ldap
# mbstring
# mysqli
# oci8
# odbc
# opcache
# pcntl
# pdo
# pdo_dblib
# pdo_firebird
# pdo_mysql
# pdo_oci
# pdo_odbc
# pdo_pgsql
# pdo_sqlite
# pgsql
# phar
# posix
# pspell
# random
# readline
# reflection
# session
# shmop
# simplexml
# snmp
# soap
# sockets
# sodium
# spl
# standard
# sysvmsg
# sysvsem
# sysvshm
# tidy
# tokenizer
# xml
# xmlreader
# xmlwriter
# xsl
# zend_test
# zip

View File

@@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 2

View File

@@ -0,0 +1,59 @@
APP_NAME=ims
APP_ENV=local
APP_KEY=base64:UbQyaTCMhtKovkRg0o417xcxyB3Kt/43LhFu3SfnTy8=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=project
DB_PASSWORD=project
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@ims.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

View File

@@ -0,0 +1,12 @@
name: issues
on:
issues:
types: [labeled]
permissions:
issues: write
jobs:
help-wanted:
uses: laravel/.github/.github/workflows/issues.yml@main

View File

@@ -0,0 +1,12 @@
name: pull requests
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
jobs:
uneditable:
uses: laravel/.github/.github/workflows/pull-requests.yml@main

View File

@@ -0,0 +1,47 @@
name: Tests
on:
push:
branches:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.1, 8.2, 8.3]
name: PHP ${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Copy environment file
run: cp .env.example .env
- name: Generate app key
run: php artisan key:generate
- name: Execute tests
run: vendor/bin/phpunit

View File

@@ -0,0 +1,13 @@
name: update changelog
on:
release:
types: [released]
permissions: {}
jobs:
update:
permissions:
contents: write
uses: laravel/.github/.github/workflows/update-changelog.yml@main

View File

@@ -0,0 +1,19 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode

View File

@@ -0,0 +1,9 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
js: true
css: true

View File

@@ -0,0 +1,113 @@
# Release Notes
## [Unreleased](https://github.com/laravel/laravel/compare/v10.3.1...10.x)
## [v10.3.1](https://github.com/laravel/laravel/compare/v10.3.0...v10.3.1) - 2023-12-23
* [10.x] Add roundrobin transport driver config by [@me-shaon](https://github.com/me-shaon) in https://github.com/laravel/laravel/pull/6301
## [v10.3.0](https://github.com/laravel/laravel/compare/v10.2.10...v10.3.0) - 2023-12-19
* [10.x] Use `assertOk()` instead of `assertStatus(200)` in tests by [@TENIOS](https://github.com/TENIOS) in https://github.com/laravel/laravel/pull/6287
* [10.x] Vite 5 by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/laravel/pull/6292
## [v10.2.10](https://github.com/laravel/laravel/compare/v10.2.9...v10.2.10) - 2023-11-30
* [10.x] Fixes missing property description by [@nunomaduro](https://github.com/nunomaduro) in https://github.com/laravel/laravel/pull/6275
* [10.x] Add partitioned cookie config key by [@fabricecw](https://github.com/fabricecw) in https://github.com/laravel/laravel/pull/6257
## [v10.2.9](https://github.com/laravel/laravel/compare/v10.2.8...v10.2.9) - 2023-11-13
- Update axios to latest version by [@emargareten](https://github.com/emargareten) in https://github.com/laravel/laravel/pull/6272
## [v10.2.8](https://github.com/laravel/laravel/compare/v10.2.7...v10.2.8) - 2023-11-02
- Revert "[10.x] Let database handle default collation" by [@taylorotwell](https://github.com/taylorotwell) in https://github.com/laravel/laravel/pull/6266
## [v10.2.7](https://github.com/laravel/laravel/compare/v10.2.6...v10.2.7) - 2023-10-31
- Postmark mailer configuration update by [@ninjaparade](https://github.com/ninjaparade) in https://github.com/laravel/laravel/pull/6228
- [10.x] Update sanctum config file by [@ahmed-aliraqi](https://github.com/ahmed-aliraqi) in https://github.com/laravel/laravel/pull/6234
- [10.x] Let database handle default collation by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/laravel/pull/6241
- [10.x] Increase bcrypt rounds to 12 by [@valorin](https://github.com/valorin) in https://github.com/laravel/laravel/pull/6245
- [10.x] Use 12 bcrypt rounds for password in UserFactory by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/laravel/pull/6247
- [10.x] Fix typo in the comment for token prefix (sanctum config) by [@yuters](https://github.com/yuters) in https://github.com/laravel/laravel/pull/6248
- [10.x] Update fixture hash to match testing cost by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/laravel/pull/6259
- [10.x] Update minimum `laravel/sanctum` by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/laravel/pull/6261
- [10.x] Hash improvements by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/laravel/pull/6258
- Redis maintenance store config example contains an excess space by [@hedge-freek](https://github.com/hedge-freek) in https://github.com/laravel/laravel/pull/6264
## [v10.2.6](https://github.com/laravel/laravel/compare/v10.2.5...v10.2.6) - 2023-08-10
- Bump `laravel-vite-plugin` to latest version by [@adevade](https://github.com/adevade) in https://github.com/laravel/laravel/pull/6224
## [v10.2.5](https://github.com/laravel/laravel/compare/v10.2.4...v10.2.5) - 2023-06-30
- Allow accessing APP_NAME in Vite scope by [@domnantas](https://github.com/domnantas) in https://github.com/laravel/laravel/pull/6204
- Omit default values for suffix in phpunit.xml by [@spawnia](https://github.com/spawnia) in https://github.com/laravel/laravel/pull/6210
## [v10.2.4](https://github.com/laravel/laravel/compare/v10.2.3...v10.2.4) - 2023-06-07
- Add `precognitive` key to $middlewareAliases by @emargareten in https://github.com/laravel/laravel/pull/6193
## [v10.2.3](https://github.com/laravel/laravel/compare/v10.2.2...v10.2.3) - 2023-06-01
- Update description by @taylorotwell in https://github.com/laravel/laravel/commit/85203d687ebba72b2805b89bba7d18dfae8f95c8
## [v10.2.2](https://github.com/laravel/laravel/compare/v10.2.1...v10.2.2) - 2023-05-23
- Add lock path by @taylorotwell in https://github.com/laravel/laravel/commit/a6bfbc7f90e33fd6cae3cb23f106c9689858c3b5
## [v10.2.1](https://github.com/laravel/laravel/compare/v10.2.0...v10.2.1) - 2023-05-12
- Add hashed cast to user password by @emargareten in https://github.com/laravel/laravel/pull/6171
- Bring back pusher cluster config option by @jesseleite in https://github.com/laravel/laravel/pull/6174
## [v10.2.0](https://github.com/laravel/laravel/compare/v10.1.1...v10.2.0) - 2023-05-05
- Update welcome.blade.php by @aymanatmeh in https://github.com/laravel/laravel/pull/6163
- Sets package.json type to module by @timacdonald in https://github.com/laravel/laravel/pull/6090
- Add url support for mail config by @chu121su12 in https://github.com/laravel/laravel/pull/6170
## [v10.1.1](https://github.com/laravel/laravel/compare/v10.0.7...v10.1.1) - 2023-04-18
- Fix laravel/framework constraints for Default Service Providers by @Jubeki in https://github.com/laravel/laravel/pull/6160
## [v10.0.7](https://github.com/laravel/laravel/compare/v10.1.0...v10.0.7) - 2023-04-14
- Adds `phpunit/phpunit@10.1` support by @nunomaduro in https://github.com/laravel/laravel/pull/6155
## [v10.1.0](https://github.com/laravel/laravel/compare/v10.0.6...v10.1.0) - 2023-04-15
- Minor skeleton slimming by @taylorotwell in https://github.com/laravel/laravel/pull/6159
## [v10.0.6](https://github.com/laravel/laravel/compare/v10.0.5...v10.0.6) - 2023-04-05
- Add job batching options to Queue configuration file by @AnOlsen in https://github.com/laravel/laravel/pull/6149
## [v10.0.5](https://github.com/laravel/laravel/compare/v10.0.4...v10.0.5) - 2023-03-08
- Add replace_placeholders to log channels by @alanpoulain in https://github.com/laravel/laravel/pull/6139
## [v10.0.4](https://github.com/laravel/laravel/compare/v10.0.3...v10.0.4) - 2023-02-27
- Fix typo by @izzudin96 in https://github.com/laravel/laravel/pull/6128
- Specify facility in the syslog driver config by @nicolus in https://github.com/laravel/laravel/pull/6130
## [v10.0.3](https://github.com/laravel/laravel/compare/v10.0.2...v10.0.3) - 2023-02-21
- Remove redundant `@return` docblock in UserFactory by @datlechin in https://github.com/laravel/laravel/pull/6119
- Reverts change in asset helper by @timacdonald in https://github.com/laravel/laravel/pull/6122
## [v10.0.2](https://github.com/laravel/laravel/compare/v10.0.1...v10.0.2) - 2023-02-16
- Remove unneeded call by @taylorotwell in https://github.com/laravel/laravel/commit/3986d4c54041fd27af36f96cf11bd79ce7b1ee4e
## [v10.0.1](https://github.com/laravel/laravel/compare/v10.0.0...v10.0.1) - 2023-02-15
- Add PHPUnit result cache to gitignore by @itxshakil in https://github.com/laravel/laravel/pull/6105
- Allow php-http/discovery as a composer plugin by @nicolas-grekas in https://github.com/laravel/laravel/pull/6106
## [v10.0.0 (2022-02-14)](https://github.com/laravel/laravel/compare/v9.5.2...v10.0.0)
Laravel 10 includes a variety of changes to the application skeleton. Please consult the diff to see what's new.

View File

@@ -0,0 +1,66 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@@ -0,0 +1,157 @@
<?php
namespace App\Http\Controllers;
use App\Models\Address;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class AddressController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
$addresses = DB::table('tbl_addresses')->get();
return view('pages.addresses.index', compact('addresses'));
}
public function delete(Request $request, string $address_id)
{
try {
DB::beginTransaction();
$exam = Address::find($address_id);
$exam->delete();
DB::commit();
return redirect()
->route('addresses.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
// return create form
return view(
'pages.addresses.create',
compact('request')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
// return create form
DB::beginTransaction();
$address = new Address();
$address->name = $validatedData['name'];
$address->description = $validatedData['description'];
$address->save();
DB::commit();
Session::forget('status');
return redirect()
->route('addresses.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $address_id)
{
try {
$address = Address::find($address_id);
return view(
'pages.addresses.edit',
compact('address')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $address_id)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
DB::beginTransaction();
$address = Address::find($address_id);
$address->name = $validatedData['name'];
$address->description = $validatedData['description'];
$address->save();
DB::commit();
Session::forget('status');
return redirect()
->route('addresses.index');
} catch (\Throwable $th) {
var_dump($request_all);
echo $th->getMessage();
}
}
public function view(Request $request, string $address_id)
{
try {
$address = Address::find($address_id);
return view(
'pages.addresses.view',
compact(
'address',
'request'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@@ -0,0 +1,186 @@
<?php
namespace App\Http\Controllers;
use App\Models\Brand;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class BrandController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
$brands = DB::table('tbl_brands')->get();
return view('pages.brands.index', compact('brands'));
}
public function delete(Request $request, string $brand_id)
{
try {
DB::beginTransaction();
$exam = Brand::find($brand_id);
$exam->delete();
DB::commit();
return redirect()
->route('brands.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
// return create form
return view(
'pages.brands.create',
compact('request')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
// return create form
DB::beginTransaction();
$brand = new Brand();
$brand->name = $validatedData['name'];
$brand->description = $validatedData['description'];
$brand->save();
DB::commit();
Session::forget('status');
return redirect()
->route('brands.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $brand_id)
{
try {
$brand = Brand::find($brand_id);
return view(
'pages.brands.edit',
compact('brand')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $brand_id)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
DB::beginTransaction();
$brand = Brand::find($brand_id);
$brand->name = $validatedData['name'];
$brand->description = $validatedData['description'];
$brand->save();
DB::commit();
Session::forget('status');
return redirect()
->route('brands.index');
} catch (\Throwable $th) {
var_dump($request_all);
echo $th->getMessage();
}
}
public function view(Request $request, string $brand_id)
{
try {
$brand = Brand::find($brand_id);
// $email_to_find = $request->user()->email;
// $current_teacher = Teacher::where('email', $email_to_find)->get()[0];
// $exam = Exam::find($exam_id);
// $exam_with_students = Exam::with(['students'])
// ->where('id', '=', $exam_id)
// ->get()[0]->students;
// $subject = Subject::find($exam->subject_id);
// return view(
// 'teachers.ViewExam',
// compact(
// 'request',
// 'current_teacher',
// 'exam',
// 'subject',
// 'exam_with_students'
// )
// );
return view(
'pages.brands.view',
compact(
'brand',
'request'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function getCount(Request $request)
{
$count = Brand::where('name', '!=', '')->count();
return $count;
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,179 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class CategoryController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
$categories = DB::table('tbl_categories')->get();
return view('pages.categories.index', compact('categories'));
}
public function delete(Request $request, string $category_id)
{
try {
DB::beginTransaction();
$exam = Category::find($category_id);
$exam->delete();
DB::commit();
return redirect()
->route('categories.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
// return create form
return view(
'pages.categories.create',
compact('request')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
// return create form
DB::beginTransaction();
$category = new Category();
$category->name = $validatedData['name'];
$category->description = $validatedData['description'];
$category->save();
DB::commit();
Session::forget('status');
return redirect()
->route('categories.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $category_id)
{
try {
$category = Category::find($category_id);
return view(
'pages.categories.edit',
compact('category')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $category_id)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'description' => ''
]);
DB::beginTransaction();
$category = Category::find($category_id);
$category->name = $validatedData['name'];
$category->description = $validatedData['description'];
$category->save();
DB::commit();
Session::forget('status');
return redirect()
->route('categories.index');
} catch (\Throwable $th) {
var_dump($request_all);
echo $th->getMessage();
}
}
public function view(Request $request, string $category_id)
{
try {
$category = Category::find($category_id);
// $email_to_find = $request->user()->email;
// $current_teacher = Teacher::where('email', $email_to_find)->get()[0];
// $exam = Exam::find($exam_id);
// $exam_with_students = Exam::with(['students'])
// ->where('id', '=', $exam_id)
// ->get()[0]->students;
// $subject = Subject::find($exam->subject_id);
// return view(
// 'teachers.ViewExam',
// compact(
// 'request',
// 'current_teacher',
// 'exam',
// 'subject',
// 'exam_with_students'
// )
// );
return view(
'pages.categories.view',
compact(
'category',
'request'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
class ChangePassword extends Controller
{
protected $user;
public function __construct()
{
Auth::logout();
$id = intval(request()->id);
$this->user = User::find($id);
}
public function show()
{
return view('auth.change-password');
}
public function update(Request $request)
{
$attributes = $request->validate([
'email' => ['required'],
'password' => ['required', 'min:5'],
'confirm-password' => ['same:password']
]);
$existingUser = User::where('email', $attributes['email'])->first();
if ($existingUser) {
$existingUser->update([
'password' => $attributes['password']
]);
return redirect('login');
} else {
return back()->with('error', 'Your email does not match the email who requested the password change');
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HelloworldController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
$exam_result = ExamResult::find(1);
$student = $exam_result->student;
return view('helloworld');
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers;
use App\Models\Address;
use App\Models\Brand;
use App\Models\Category;
use App\Models\Item;
use App\Models\Order;
use App\Models\Product;
use App\Models\Project;
use App\Models\User;
use App\Models\UserGroup;
use App\Models\UserRole;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
// public function __construct()
// {
// $this->middleware('auth');
// }
/**
* Show the application dashboard.
*
* @return \Illuminate\View\View
*/
public function index()
{
$user_role_count = UserRole::where('name', '!=', '')->count();
$user_group_count = UserGroup::where('name', '!=', '')->count();
$user_count = User::where('email', '!=', '')->count();
$project_count = Project::where('name', '!=', '')->count();
// $product_count = Product::where('name', '!=', '')->count();
$order_count = Order::where('name', '!=', '')->count();
$item_count = Item::where('name', '!=', '')->count();
$category_count = Category::where('name', '!=', '')->count();
$brand_count = Brand::where('name', '!=', '')->count();
$address_count = Address::where('name', '!=', '')->count();
return view(
'pages.dashboard',
compact(
'user_role_count',
'user_group_count',
'user_count',
'project_count',
'order_count',
'item_count',
'category_count',
'brand_count',
'address_count',
)
);
}
}

View File

@@ -0,0 +1,253 @@
<?php
namespace App\Http\Controllers;
use App\Models\Address;
use App\Models\Brand;
use App\Models\Category;
use App\Models\Item;
use App\Models\User;
use App\Models\UserGroup;
use App\Models\UserRole;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class ItemController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
try {
$items = Item::with(['locations'])->get();
$users = User::all();
$addresses = Address::all();
return view(
'pages.items.index',
compact(
'items',
'addresses',
'users'
)
);
} catch (\Throwable $th) {
dd($th);
}
}
public function delete(Request $request, string $item_id)
{
try {
DB::beginTransaction();
$exam = Item::find($item_id);
$exam->delete();
DB::commit();
return redirect()
->route('items.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
$brands = Brand::all();
$categories = Category::all();
$addresses = Address::all();
$users = User::all();
$user_group = UserGroup::all();
$user_role = UserRole::all();
return view(
'pages.items.create',
compact(
'request',
'brands',
'addresses',
'categories',
'users'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'name' => '',
'category_id' => '',
'brand_id' => '',
'location_id' => '',
'owner_id' => '',
'description' => ''
]);
// return create form
DB::beginTransaction();
$item = new Item();
$item->name = $validatedData['name'];
$item->description = $validatedData['description'];
$item->save();
$new_location_id = $validatedData['location_id'];
$item->locations()->attach($new_location_id);
$new_brand_id = $validatedData['brand_id'];
$item->brands()->attach($new_brand_id);
$new_category_id = $validatedData['category_id'];
$item->categories()->attach($new_category_id);
$new_owner_id = $validatedData['owner_id'];
$item->owners()->attach($new_owner_id);
$item->save();
DB::commit();
Session::forget('status');
return redirect()
->route('items.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $item_id)
{
try {
$item = Item::find($item_id);
$brands = Brand::all();
$categories = Category::all();
$addresses = Address::all();
$users = User::all();
$user_group = UserGroup::all();
$user_role = UserRole::all();
return view(
'pages.items.edit',
compact(
'item',
"brands",
'categories',
'addresses',
'users',
'user_role',
'user_group'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $item_id)
{
try {
$request_all = $request->all();
$validatedData = $request->validate([
'name' => '',
'location_id' => '',
'brand_id' => '',
'owner_id' => '',
'category_id' => '',
'description' => ''
]);
DB::beginTransaction();
$item = Item::find($item_id);
$item->name = $validatedData['name'];
$item->description = $validatedData['description'];
$new_location_id = $validatedData['location_id'];
$locations = $item->locations;
foreach ($locations as $location) {
$item->locations()->detach($location->id);
}
$item->locations()->attach($new_location_id);
$new_brand_id = $validatedData['brand_id'];
$brands = $item->brands;
foreach ($brands as $brand) {
$item->brands()->detach($brand->id);
}
$item->brands()->attach($new_brand_id);
$new_category_id = $validatedData['category_id'];
$categories = $item->categories;
foreach ($categories as $category) {
$item->categories()->detach($category->id);
}
$item->categories()->attach($new_category_id);
$new_owner_id = $validatedData['owner_id'];
$owners = $item->owners;
foreach ($owners as $owner) {
$item->owners()->detach($owner->id);
}
$item->owners()->attach($new_owner_id);
// done ?
$item->save();
DB::commit();
Session::forget('status');
return redirect()
->route('items.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function view(Request $request, string $item_id)
{
try {
$item = Item::find($item_id);
return view(
'pages.items.view',
compact(
'item',
'request'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Password;
class LoginController extends Controller
{
/**
* Display login page.
*
* @return Renderable
*/
public function show()
{
return view('auth.login');
}
public function login(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
$request->session()->regenerate();
return redirect()->intended('dashboard');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/login');
}
}

View File

@@ -0,0 +1,174 @@
<?php
namespace App\Http\Controllers;
use App\Models\Order;
use App\Models\Project;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class OrderController extends Controller
{
public function index()
{
// $student = Student::find(1);
// $exam_results = $student->exam_results;
// dd($exam_results);
$orders = Order::with(['projects'])->get();
return view('pages.orders.index', compact('orders'));
}
public function delete(Request $request, string $item_id)
{
try {
DB::beginTransaction();
$exam = Order::find($item_id);
$exam->delete();
DB::commit();
return redirect()
->route('orders.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
$projects = Project::all();
return view(
'pages.orders.create',
compact('request', 'projects')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'name' => '',
'description' => '',
'project_id' => '',
'status' => ''
]);
// return create form
DB::beginTransaction();
$order = new Order();
$order->save();
$order->name = $validatedData['name'];
$order->description = $validatedData['description'];
$order->status = $validatedData['status'];
$new_project_id = $validatedData['project_id'];
$order->projects()->attach($new_project_id);
$order->save();
DB::commit();
Session::forget('status');
return redirect()
->route('orders.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $order_id)
{
try {
$order = Order::where('id', $order_id)->with(['projects'])->get()[0];
$projects = Project::all();
return view(
'pages.orders.edit',
compact('order', 'projects', )
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $order_id)
{
try {
$validatedData = $request->validate([
'name' => '',
'description' => '',
"project_id" => '',
'status' => ""
]);
DB::beginTransaction();
$item = Order::where('id', $order_id)->with(['projects'])->get()[0];
$item->name = $validatedData['name'];
$item->description = $validatedData['description'];
$item->status = $validatedData['status'];
$new_project_id = $validatedData['project_id'];
$projects = $item->projects;
foreach ($projects as $project) {
$item->projects()->detach($project->id);
}
$item->projects()->attach($new_project_id);
$item->save();
DB::commit();
Session::forget('status');
return redirect()
->route('orders.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function view(Request $request, string $order_id)
{
try {
$order = Order::where('id', $order_id)->with(['projects'])->get()[0];
return view(
'pages.orders.view',
compact(
'order',
'request'
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PageController extends Controller
{
/**
* Display all the static pages when authenticated
*
* @param string $page
* @return \Illuminate\View\View
*/
public function index(string $page)
{
if (view()->exists("pages.{$page}")) {
return view("pages.{$page}");
}
return abort(404);
}
public function vr()
{
return view("pages.virtual-reality");
}
public function rtl()
{
return view("pages.rtl");
}
public function profile()
{
return view("pages.profile-static");
}
public function signin()
{
return view("pages.sign-in-static");
}
public function signup()
{
return view("pages.sign-up-static");
}
}

Some files were not shown because too many files have changed in this diff Show More