update,
This commit is contained in:
9
teddy_y/docker-share/Dockerfile
Normal file
9
teddy_y/docker-share/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
# CREDIT: https://github.com/shren207/nextjs-docker-compose
|
||||
# Dockerfile
|
||||
FROM node:18-buster
|
||||
|
||||
RUN mkdir -p /app/node_modules
|
||||
RUN chown 1000:1000 -R /app
|
||||
WORKDIR /app
|
||||
|
||||
USER 1000:1000
|
5
teddy_y/docker-share/app/entry.sh
Normal file
5
teddy_y/docker-share/app/entry.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
npm i
|
||||
npm run start
|
2117
teddy_y/docker-share/app/package-lock.json
generated
Normal file
2117
teddy_y/docker-share/app/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
teddy_y/docker-share/app/package.json
Normal file
17
teddy_y/docker-share/app/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "http-server --cors ./public"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"http-server": "^14.1.1",
|
||||
"serve": "^14.2.0"
|
||||
}
|
||||
}
|
1
teddy_y/docker-share/app/public/index.html
Normal file
1
teddy_y/docker-share/app/public/index.html
Normal file
@@ -0,0 +1 @@
|
||||
helloworld teddy_y
|
32
teddy_y/docker-share/docker-compose.yml
Normal file
32
teddy_y/docker-share/docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
# CREDIT: https://github.com/shren207/nextjs-docker-compose
|
||||
# CREATED: 04-07-2023
|
||||
services:
|
||||
teddy_y_share:
|
||||
container_name: teddy_y_share
|
||||
build: .
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/app:/app
|
||||
- teddy_y_node_modules:/app/node_modules
|
||||
working_dir: /app
|
||||
# command: sleep infinity
|
||||
command: bash entry.sh
|
||||
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.teddy_y-http.rule=Host(`teddy_y.louislabs.com`)"
|
||||
- "traefik.http.routers.teddy_y-http.entrypoints=web"
|
||||
- "traefik.http.routers.teddy_y-http.middlewares=teddy_y-https"
|
||||
- "traefik.http.middlewares.teddy_y-https.redirectscheme.scheme=https"
|
||||
- "traefik.http.routers.teddy_y.rule=Host(`teddy_y.louislabs.com`)"
|
||||
- "traefik.http.routers.teddy_y.entrypoints=websecure"
|
||||
- "traefik.http.routers.teddy_y.tls.certresolver=myresolver"
|
||||
- "traefik.http.services.teddy_y.loadbalancer.server.port=8080"
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: traefik-proxy-network
|
||||
|
||||
volumes:
|
||||
teddy_y_node_modules:
|
13
teddy_y/docker-share/package.json
Normal file
13
teddy_y/docker-share/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "docker-helloworld",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"into_docker": "docker compose exec -it test bash"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
9
teddy_y/docker-share/up.sh
Normal file
9
teddy_y/docker-share/up.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
git pull
|
||||
|
||||
docker compose pull
|
||||
docker compose build
|
||||
docker compose kill
|
||||
docker compose down
|
||||
docker compose up -d
|
7
teddy_y/gitUpdate.bat
Normal file
7
teddy_y/gitUpdate.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
git status .
|
||||
|
||||
@pause
|
||||
|
||||
git add .
|
||||
git commit -m"update teddy_y,"
|
||||
start git push
|
145
teddy_y/job1/requirement.txt
Normal file
145
teddy_y/job1/requirement.txt
Normal file
@@ -0,0 +1,145 @@
|
||||
1.採購經理界面
|
||||
|
||||
為採購經理操作創建導航菜單:
|
||||
|
||||
下訂單(Make orders)
|
||||
查看訂單記錄(View order records)
|
||||
更新採購經理信息(Update purchase manager's information)
|
||||
刪除訂單記錄(Delete order record)
|
||||
|
||||
1.1.為每個操作設計單獨的頁面和表單,合併您的規範中提到的必填字段和功能。
|
||||
|
||||
1.2. 下訂單
|
||||
為所需的訂單信息創建一個帶有輸入字段的表單。
|
||||
使用 JavaScript 自動生成訂單 ID。
|
||||
使用 JavaScript 或日期選擇器庫來選擇訂單日期和時間以及交貨日期。
|
||||
使用可排序和可過濾的表格或列表顯示可用項目,允許用戶將項目添加到訂單中。
|
||||
|
||||
* Sort the list of items wisely to facilitate smart purchasing
|
||||
|
||||
Required information for creating an order as below:
|
||||
|
||||
1. Order ID
|
||||
2. Purchase Manager ID
|
||||
3. Manager Name
|
||||
4. Order Date & Time
|
||||
5. Delivery Address
|
||||
6. Delivery Date
|
||||
7. Item ID
|
||||
8. Item Image
|
||||
9. Item Name
|
||||
10. Order Quantity
|
||||
11. Item Price
|
||||
12. Total Order Amount
|
||||
|
||||
* orderID should be generated automatically by the system as Primary Key
|
||||
* update the stock item quantity after an order is created
|
||||
|
||||
|
||||
1.3. 查看訂單記錄
|
||||
在表格或列表中顯示訂單記錄。
|
||||
允許用戶按至少兩列對數據進行排序和過濾。
|
||||
按供應商對訂購的物品進行分組。
|
||||
|
||||
Required information for order record page:
|
||||
|
||||
1. Order ID
|
||||
2. Supplier ID
|
||||
3. Supplier’s Company Name
|
||||
4. Supplier’s Contact Name
|
||||
5. Supplier’s Contact Number
|
||||
6. Order Date & Time
|
||||
7. Delivery Address
|
||||
8. Delivery Date
|
||||
9. Item ID
|
||||
10. Item Image
|
||||
11. Item Name
|
||||
12. Order Quantity
|
||||
13. Total Order Amount
|
||||
|
||||
|
||||
Function requirement:
|
||||
* Group ordered items by suppliers
|
||||
* List the items in ascending or descending order by at least TWO columns selectable by the user
|
||||
|
||||
1.4. 更新採購經理的信息
|
||||
創建一個表單,其中包含用於更新密碼、聯繫電話和倉庫地址的輸入字段。
|
||||
|
||||
Only allow the use to update the following information:
|
||||
1. Password
|
||||
2. Contact Number
|
||||
3. Warehouse Address
|
||||
|
||||
|
||||
1.5. 刪除訂單記錄
|
||||
在“查看訂單記錄”部分為每條訂單記錄添加刪除按鈕。
|
||||
在刪除記錄之前使用 JavaScript 顯示確認消息。
|
||||
刪除訂單後更新庫存項目數量。
|
||||
|
||||
Function requirement:
|
||||
- A confirmation message should be displayed to let the user decide whether the selected order should be deleted or not.
|
||||
|
||||
* The order can only be deleted two days or before the receipts delivery date.
|
||||
|
||||
|
||||
2.供應商界面
|
||||
|
||||
為供應商操作創建導航菜單:
|
||||
|
||||
插入項目信息(Insert item's information)
|
||||
編輯物品信息(Edit item's information)
|
||||
生成報告(Generate report)
|
||||
刪除項目(Delete Item)
|
||||
|
||||
2.1. 為每個操作設計單獨的頁面和表單,合併您的規範中提到的必填字段和功能。
|
||||
|
||||
2.2. 插入項目信息
|
||||
創建一個表單,其中包含所需項目信息的輸入字段。
|
||||
使用 JavaScript 自動生成項目 ID。
|
||||
|
||||
Required Item information:
|
||||
|
||||
1. Item ID
|
||||
2. Suppler ID
|
||||
3. Item Name
|
||||
4. Item Image
|
||||
5. Item Description
|
||||
6. Stock Item Quantity
|
||||
7. Price
|
||||
|
||||
|
||||
*itemID should be generate automatically by the system as Primary Key.
|
||||
|
||||
2.3.編輯物品信息
|
||||
創建一個表單,其中包含所需項目信息的輸入字段。
|
||||
加載現有的項目數據進行編輯。
|
||||
|
||||
Required Item information:
|
||||
|
||||
1. Item Description
|
||||
2. Item Image
|
||||
3. Stock Item Quantity
|
||||
4. Price
|
||||
|
||||
2.4. 生成報告
|
||||
顯示包含報告頁面所需信息的表格或列表。
|
||||
計算每個訂單項目的總銷售額。
|
||||
|
||||
Required information for report page:
|
||||
1. Item ID
|
||||
2. Item Name
|
||||
3. Item Image
|
||||
4. Total number for each order item
|
||||
5. Total sales amount ($) for each order item *
|
||||
|
||||
*total sales amount = price * order quantity
|
||||
|
||||
|
||||
2.5. 刪除項目
|
||||
為供應商的項目列表中的每個項目添加一個刪除按鈕。
|
||||
在刪除項目之前使用 JavaScript 顯示確認消息。
|
||||
|
||||
Function requirement:
|
||||
- A confirmation message should be displayed to let the user decide whether the selected item should be deleted or not..
|
||||
|
||||
* An item can be deleted only when the item has no existing related orders.
|
7
teddy_y/meta.md
Normal file
7
teddy_y/meta.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
tags: [pending, aws, laravel]
|
||||
---
|
||||
|
||||
# teddy_y
|
||||
|
||||
https://github.com/khwang0/comp2045-2324pa1
|
22
teddy_y/package.json
Normal file
22
teddy_y/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "daniel_jo_assignment_student",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"doc": "docs"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate": "git add . && git commit -m\"update teddy_y,\" && git push"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"bootstrap": "^5.2.3",
|
||||
"react-bootstrap": "^2.6.0"
|
||||
}
|
||||
}
|
BIN
teddy_y/quotation2/LMS Project.odt
Normal file
BIN
teddy_y/quotation2/LMS Project.odt
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/LMS_remake note.docx
Normal file
BIN
teddy_y/quotation2/LMS_remake note.docx
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 21-47-42.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 21-47-42.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-02-52.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-02-52.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-32.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-32.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-38.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-38.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-44.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-44.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-50.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-50.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-57.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-03-57.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-04.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-04.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-15.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-15.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-20.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-20.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-27.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-27.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-32.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-32.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-40.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-40.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-48.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-48.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-55.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-04-55.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-01.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-01.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-09.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-09.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-14.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/admin/Screenshot from 2023-08-08 22-05-14.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/4iuKD3.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/4iuKD3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/MfZmuJ.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/MfZmuJ.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/XMCLNV.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/XMCLNV.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/YLhjqT.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/YLhjqT.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/ahj70K.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/ahj70K.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/ahwGNP.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/ahwGNP.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/n5FYka.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/n5FYka.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/snQzrN.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/snQzrN.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
teddy_y/quotation2/docs/front/zncKnX.png
(Stored with Git LFS)
Normal file
BIN
teddy_y/quotation2/docs/front/zncKnX.png
(Stored with Git LFS)
Normal file
Binary file not shown.
12
teddy_y/quotation2/laravel-simple-tryout/.editorconfig
Normal file
12
teddy_y/quotation2/laravel-simple-tryout/.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
144
teddy_y/quotation2/laravel-simple-tryout/.gitignore
vendored
Normal file
144
teddy_y/quotation2/laravel-simple-tryout/.gitignore
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node
|
||||
|
||||
### 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
|
||||
node_modules/
|
||||
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
|
||||
.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/node
|
@@ -0,0 +1,6 @@
|
||||
# Stop and remove all running containers
|
||||
docker stop $(docker ps -a -q)
|
||||
docker rm $(docker ps -a -q)
|
||||
|
||||
# Remove all container images
|
||||
docker rmi $(docker images -q)
|
33
teddy_y/quotation2/laravel-simple-tryout/docker-compose.yml
Normal file
33
teddy_y/quotation2/laravel-simple-tryout/docker-compose.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
services:
|
||||
php74-httpd:
|
||||
# image: composer
|
||||
build: php74-httpd
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- ./php74-httpd:/app
|
||||
- ./php74-httpd/php-cli.ini:/usr/local/etc/php/php-cli.ini
|
||||
working_dir: /app
|
||||
user: 1000:1000
|
||||
command: sleep infinity
|
||||
|
||||
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
|
10
teddy_y/quotation2/laravel-simple-tryout/init_helloworld.sh
Normal file
10
teddy_y/quotation2/laravel-simple-tryout/init_helloworld.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
rm -rf example-app
|
||||
|
||||
composer create-project laravel/laravel example-app
|
||||
|
||||
pushd example-app
|
||||
php artisan serve --host 0.0.0.0
|
8
teddy_y/quotation2/laravel-simple-tryout/pack.ps1
Normal file
8
teddy_y/quotation2/laravel-simple-tryout/pack.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
pushd ..
|
||||
|
||||
Compress-Archive laravel-helloworld-tryout-simple delivery-new.zip
|
||||
rm .\delivery.zip
|
||||
mv .\delivery-new.zip .\delivery.zip
|
||||
|
||||
popd
|
3156
teddy_y/quotation2/laravel-simple-tryout/package-lock.json
generated
Normal file
3156
teddy_y/quotation2/laravel-simple-tryout/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
teddy_y/quotation2/laravel-simple-tryout/package.json
Normal file
17
teddy_y/quotation2/laravel-simple-tryout/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "laravel-docker-helloworld",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate": "git add . && git commit -m\"update laravel-material-dashboard-simple-tryout,\" && git push",
|
||||
"watch-bs": "browser-sync start --proxy \"localhost:8009\" --files \"**/*.php\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.29.1"
|
||||
}
|
||||
}
|
12
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/dev.sh
Normal file
12
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/dev.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
pushd ./example-app
|
||||
# composer update
|
||||
composer install
|
||||
|
||||
php artisan migrate:fresh --seed
|
||||
|
||||
php artisan serve --host 0.0.0.0
|
||||
popd
|
@@ -0,0 +1,4 @@
|
||||
FROM composer
|
||||
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql
|
||||
|
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
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 = 4
|
@@ -0,0 +1,58 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=project_lms
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
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@example.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_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}"
|
11
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/example-app/.gitattributes
vendored
Normal file
11
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/example-app/.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
* text=auto
|
||||
|
||||
*.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
|
18
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/example-app/.gitignore
vendored
Normal file
18
teddy_y/quotation2/laravel-simple-tryout/php74-httpd/example-app/.gitignore
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/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
|
@@ -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://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.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 [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## 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).
|
@@ -0,0 +1,32 @@
|
||||
<?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.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of exception types with their corresponding custom log levels.
|
||||
*
|
||||
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
||||
*/
|
||||
protected $levels = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<\Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A 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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace App\Helper;
|
||||
|
||||
class Helpers {
|
||||
|
||||
public static function getunlimitedTestAttempt($attempt)
|
||||
{
|
||||
$html = "";
|
||||
if($attempt == 1){
|
||||
$html = "<label class='badge badge-success'>Yes</label>";
|
||||
}else{
|
||||
$html = "<lable class='badge badge-primary'>No</lable>";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
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 = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
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 = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
public function index() {
|
||||
if(Auth::check()){
|
||||
return redirect(route('admin.dashboard'));
|
||||
}
|
||||
return view('admin.login');
|
||||
}
|
||||
/* Login Check Authenticate User */
|
||||
public function login(Request $request){
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|email|max:255',
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
|
||||
return redirect('login')
|
||||
->withErrors($validator, 'login')
|
||||
->withInput();
|
||||
}
|
||||
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
|
||||
$user = Auth::user();
|
||||
if($user->email_verified_at && $user->email_verified_at ==null){
|
||||
$this->logout($request);
|
||||
redirect()->route('login')->with("error","Your are not verified user.");
|
||||
}
|
||||
if($user->role == 1){
|
||||
return redirect()->route('admin.dashboard')->with("success","Welcome To ". env("APP_NAME"));
|
||||
}else{
|
||||
redirect()->route('login')->with("error","Your are not authorized user.");
|
||||
}
|
||||
|
||||
}else{
|
||||
return redirect()->back()->with("error","Invalid Email Or Password.");
|
||||
}
|
||||
}
|
||||
|
||||
/*Logout*/
|
||||
public function logout(Request $request){
|
||||
Auth::logout();
|
||||
$request->session()->regenerateToken();
|
||||
return redirect()->route('login');
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
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 = RouteServiceProvider::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']),
|
||||
]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use App\Models\ResetPassword;
|
||||
use App\Jobs\SendEmailJob;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
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 = RouteServiceProvider::HOME;
|
||||
|
||||
public function forgotpassword() {
|
||||
return view('admin.forgotpassword');
|
||||
}
|
||||
|
||||
public function sendEmailForgotPassword(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|email|max:255',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('forgotpassword')
|
||||
->withErrors($validator, 'forgotpassword')
|
||||
->withInput();
|
||||
}
|
||||
$user = User::where('email', $request->email)->first();
|
||||
if (!$user) {
|
||||
return redirect()->route('forgotpassword')->with("error", "Your not Registered User.");
|
||||
}
|
||||
$token = Crypt::encrypt($request->email);
|
||||
ResetPassword::updateOrCreate(["email" => $request->email, 'token' => $token]);
|
||||
dispatch(new SendEmailJob([
|
||||
'_blade' => 'forgot',
|
||||
'name' => $user->name,
|
||||
'toemail' => $request->email,
|
||||
'token' => $token,
|
||||
'url' => route('resetpassword', $token)
|
||||
]));
|
||||
return redirect()->route('forgotpassword')->with("success", "Your Forgot Password mail has been sent Succefully!");
|
||||
}
|
||||
|
||||
public function resetpassword($token) {
|
||||
$resetpasswordData = ResetPassword::where('token', $token)->first();
|
||||
if (empty($resetpasswordData)) {
|
||||
return redirect()->route('login')->with("error", "Your Reset Password link has been expired.");
|
||||
}
|
||||
return view('admin.resetpassword', compact('resetpasswordData'));
|
||||
}
|
||||
|
||||
public function postResetPassword(Request $request) {
|
||||
if ($request->password != $request->confirmpassword) {
|
||||
return redirect()->route('resetpassword')->with("error", "Password and Confirm Password has been not match.");
|
||||
}
|
||||
$email = $request->email;
|
||||
User::where('email', $email)->update(["password" => Hash::make($request->password)]);
|
||||
ResetPassword::where('email', $email)->delete();
|
||||
return redirect()->route('login')->with("success", "Your Password has been Reset Succefully!");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
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 = RouteServiceProvider::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');
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Country;
|
||||
use App\Models\State;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CountryController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('admin.country.index');
|
||||
}
|
||||
|
||||
public function getCountryList(Request $request){
|
||||
return Country::getCountryList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
return view('admin.country.create');
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|unique:country,name',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.country.add')
|
||||
->withErrors($validator, 'country')
|
||||
->withInput();
|
||||
}
|
||||
$country = Country::addEditCountry($request);
|
||||
if($country){
|
||||
return redirect()->route('admin.country')->with("success","Country add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.add-country')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$country = Country::find($id);
|
||||
return view('admin.country.edit',compact('country'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|unique:country,name,'.$id,
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.country.edit',$id)
|
||||
->withErrors($validator, 'country')
|
||||
->withInput();
|
||||
}
|
||||
$country = Country::addEditCountry($request,$id);
|
||||
if($country){
|
||||
return redirect()->route('admin.country')->with("success","Country update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.country.edit',$id)->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{ $state = State::where('country_id',$request->id)->get();
|
||||
if ($state->count() == 0){
|
||||
$data = Country::countrydelete($request->id);
|
||||
if($data == 1){
|
||||
echo json_encode(["status"=>1]);exit;
|
||||
}else{
|
||||
echo json_encode(["status"=>0]);exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["status"=>2]);exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Exam;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\ExamCategory;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class ExamCategoryController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.examcategory.index');
|
||||
}
|
||||
|
||||
public function getExamCategoryList(Request $request){
|
||||
return ExamCategory::getExamCategoryList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
return view('admin.examcategory.create');
|
||||
}
|
||||
|
||||
function store(Request $request){
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'title' => 'required|unique:exam_category,title'
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.examcategory.add')
|
||||
->withErrors($validator, 'examcategory')
|
||||
->withInput();
|
||||
}
|
||||
$state = ExamCategory::addEditExamCategory($request);
|
||||
if($state){
|
||||
return redirect()->route('admin.examcategory')->with("success","Exam Category add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.examcategory.add')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$examcategory = ExamCategory::find($id);
|
||||
return view('admin.examcategory.edit',compact('examcategory'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id){
|
||||
$validator = Validator::make($request->all(), [
|
||||
'title' => 'required|unique:exam_category,title,except'.$id
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.examcategory.edit',$id)
|
||||
->withErrors($validator, 'examcategory')
|
||||
->withInput();
|
||||
}
|
||||
$country = ExamCategory::addEditExamCategory($request,$id);
|
||||
if($country){
|
||||
return redirect()->route('admin.examcategory')->with("success","Exam Category update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.examcategory.edit')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request){
|
||||
$exam = Exam::where('exam_category_id',$request->id)->get();
|
||||
if ($exam->count() == 0){
|
||||
$data = ExamCategory::ExamCategorydelete($request->id);
|
||||
if($data == 1){
|
||||
echo json_encode(["status"=>1]);exit;
|
||||
}else{
|
||||
echo json_encode(["status"=>0]);exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["status"=>2]);exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Country;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Exam;
|
||||
use App\Models\ExamCategory;
|
||||
use App\Models\Plan;
|
||||
use App\Models\State;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ExamController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.exam.index');
|
||||
}
|
||||
|
||||
public function getExamList(Request $request){
|
||||
return Exam::getExamList($request);
|
||||
}
|
||||
public function get_StateList(Request $request)
|
||||
{
|
||||
$country = $request->country_id;
|
||||
$state = State::get_StateList($country);
|
||||
return Response::json($state);
|
||||
}
|
||||
public function create(Request $request){
|
||||
$country = Country::get_CountryList();
|
||||
$examCategory = ExamCategory::get_ExamCategoryList();
|
||||
return view('admin.exam.create',compact('country','examCategory'));
|
||||
}
|
||||
|
||||
function store(Request $request){
|
||||
$validator = Validator::make($request->all(), [
|
||||
'country' => 'required',
|
||||
'state' => 'required',
|
||||
'examcategory' => 'required',
|
||||
'name' => 'required|unique:exam,name',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()
|
||||
->route('admin.exam.add')
|
||||
->withErrors($validator, 'exam')
|
||||
->withInput();
|
||||
}
|
||||
$Exam = Exam::addEditExam($request);
|
||||
if ($Exam) {
|
||||
return redirect()
|
||||
->route('admin.exam')
|
||||
->with('success', 'Exam update Successfully!');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('admin.exam.add')
|
||||
->with('error', 'Some thing went wrong!');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$exam = Exam::find($id);
|
||||
$country = Country::get_CountryList();
|
||||
$state = State::all();
|
||||
$examCategory = ExamCategory::get_ExamCategoryList();
|
||||
return view('admin.exam.edit', compact('exam','country','state','examCategory'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id){
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|unique:exam,name,'. $id,
|
||||
'country' => 'required',
|
||||
'state' => 'required',
|
||||
'examcategory' => 'required',
|
||||
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()
|
||||
->route('admin.exam.edit', $id)
|
||||
->withErrors($validator, 'exam')
|
||||
->withInput();
|
||||
}
|
||||
$Exam = Exam::addEditExam($request, $id);
|
||||
if ($Exam) {
|
||||
return redirect()
|
||||
->route('admin.exam')
|
||||
->with('success', 'Exam update Successfully!');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('admin.Exam.edit', $id)
|
||||
->with('error', 'Some thing went wrong!');
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request){
|
||||
$plan = Plan::where('exam_id',$request->id)->get();
|
||||
if ($plan->count() == 0){
|
||||
$data = Exam::Examdelete($request->id);
|
||||
if($data == 1){
|
||||
echo json_encode(["status"=>1],true);exit;
|
||||
}else{
|
||||
echo json_encode(["status"=>0],true);exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["status"=>2],true);exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Services\CommonService;
|
||||
|
||||
class HomeController extends Controller {
|
||||
|
||||
protected $service;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CommonService $userService) {
|
||||
$this->middleware('auth');
|
||||
$this->service = $userService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function dashboard() {
|
||||
if (Auth::user()) {
|
||||
$data['totalExam'] = $this->service->totalExam();
|
||||
$data['totalPlan'] = $this->service->totalPlan();
|
||||
$data['totalSubject'] = $this->service->totalSubject();
|
||||
$data['totalTest'] = $this->service->totalTest();
|
||||
$data['totalCountry'] = $this->service->totalCountry();
|
||||
$data['totalState'] = $this->service->totalState();
|
||||
return view('admin.dashboard', compact('data'));
|
||||
} else {
|
||||
Auth::logout();
|
||||
return redirect(route('login'));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Admin Profile
|
||||
*/
|
||||
|
||||
public function profile() {
|
||||
$user = User::find(Auth::user()->id);
|
||||
return view('admin.profile', compact('user'));
|
||||
}
|
||||
|
||||
/*
|
||||
* Update User Profile
|
||||
*/
|
||||
|
||||
public function updateProfile(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|max:255',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('admin/profile')->withErrors($validator, 'profile')->withInput();
|
||||
}
|
||||
User::updateProfile($request, Auth::user()->id);
|
||||
return redirect()->route('admin.profile')->with('success', 'Profile Update Successfully!');
|
||||
}
|
||||
|
||||
/*
|
||||
* Update User Password
|
||||
*/
|
||||
|
||||
public function updatePassword(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'currentpassword' => 'required|max:255',
|
||||
'newpassword' => 'required|max:255',
|
||||
'password_confirmation' => 'required|max:255|same:newpassword',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('admin/profile')->withErrors($validator, 'changepassword')->withInput();
|
||||
}
|
||||
if (!Hash::check($request->currentpassword, Auth::user()->password)) {
|
||||
return redirect()->route('admin.profile')->with('error', 'Password and Current Password does not match.');
|
||||
}
|
||||
if ($request->newpassword != $request->password_confirmation) {
|
||||
return redirect()->route('admin.profile')->with('error', 'New Password and Confirm Password does not match.');
|
||||
}
|
||||
User::updatePassword($request, Auth::user()->id);
|
||||
return redirect()->route('admin.profile')->with('success', 'Password Change Successfully!');
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Exam;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Plan;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class PlanController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.plan.index');
|
||||
}
|
||||
|
||||
public function getPlanList(Request $request){
|
||||
return Plan::getPlanList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
$exam = Exam::all();
|
||||
return view('admin.plan.create',compact('exam'));
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'exam' => 'required',
|
||||
'name' => 'required|unique:plans,name',
|
||||
'year' => 'required|numeric',
|
||||
'price' => 'required',
|
||||
'validity' => 'required',
|
||||
'unlimited_test_attempt'=>"required",
|
||||
'attempt' => 'required_if:unlimited_test_attempt,==,0',
|
||||
]);
|
||||
$message = array(
|
||||
'required_if' =>'Attempt field is required.'
|
||||
);
|
||||
if ($validator->fails($message)) {
|
||||
return redirect()->route('admin.plan.add')
|
||||
->withErrors($validator, 'plan')
|
||||
->withInput();
|
||||
}
|
||||
$plan = Plan::addEditPlan($request);
|
||||
if($plan){
|
||||
return redirect()->route('admin.plan')->with("success","Plan add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.add-plan')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$exam = Exam::all();
|
||||
$plan = Plan::find($id);
|
||||
return view('admin.plan.edit',compact('plan','exam'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'exam' => 'required',
|
||||
'name' => 'required|unique:plans,name,'.$id,
|
||||
'year' => 'required|numeric',
|
||||
'price' => 'required',
|
||||
'validity' => 'required',
|
||||
'unlimited_test_attempt'=>"required",
|
||||
'attempt' => 'required_if:unlimited_test_attempt,==,0',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.plan.edit',$id)
|
||||
->withErrors($validator, 'plan')
|
||||
->withInput();
|
||||
}
|
||||
$plan = Plan::addEditPlan($request,$id);
|
||||
if($plan){
|
||||
return redirect()->route('admin.plan')->with("success","Plan update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.plan.edit',$id)->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{ $exam = Plan::where('id',$request->id)->get();
|
||||
if(empty($state)){
|
||||
$data = Plan::countrydelete($request->id);
|
||||
if($data == 1){
|
||||
echo json_encode(["status"=>1]);exit;
|
||||
}else{
|
||||
echo json_encode(["status"=>2]);exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["status"=>0]);exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\State;
|
||||
use App\Models\Country;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class StateController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.state.index');
|
||||
}
|
||||
|
||||
public function getStateList(Request $request){
|
||||
return State::getStateList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
$country = Country::get_CountryList();
|
||||
return view('admin.state.create',compact('country'));
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'country' =>'required',
|
||||
'name' => 'required|unique:state,name',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('admin/add-state')
|
||||
->withErrors($validator, 'state')
|
||||
->withInput();
|
||||
}
|
||||
$state = State::addEditState($request);
|
||||
if($state){
|
||||
return redirect()->route('admin.state')->with("success","State add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.add-state')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$country = Country::get_CountryList();
|
||||
$state = State::find($id);
|
||||
return view('admin.state.edit',compact('country','state'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'country' =>'required',
|
||||
'name' => 'required|unique:state,name,'.$id
|
||||
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.state.edit',$id)
|
||||
->withErrors($validator, 'state')
|
||||
->withInput();
|
||||
}
|
||||
$state = State::addEditState($request,$id);
|
||||
if($state){
|
||||
return redirect()->route('admin.state')->with("success","State update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.state.edit',$id)->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$data = State::Statedelete($request->id);
|
||||
if($data == 1){
|
||||
return Response::json(["status"=>true],200);
|
||||
}else{
|
||||
return Response::json(["status"=>false],500);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use App\Models\Subject;
|
||||
use App\Models\Plan;
|
||||
use App\Models\Test;
|
||||
|
||||
class SubjectController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.subject.index');
|
||||
}
|
||||
|
||||
public function getSubjectList(Request $request){
|
||||
return Subject::getSubjectList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
$plan = Plan::get_PlanList();
|
||||
return view('admin.subject.create',compact('plan'));
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'plan' =>'required',
|
||||
'name' => 'required|unique:subjects,name',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('admin/add-subject')
|
||||
->withErrors($validator, 'state')
|
||||
->withInput();
|
||||
}
|
||||
$state = Subject::addEditSubject($request);
|
||||
if($state){
|
||||
return redirect()->route('admin.subject')->with("success","State add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.add-subject')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$plan = Plan::get_PlanList();
|
||||
$subject = Subject::find($id);
|
||||
return view('admin.subject.edit',compact('plan','subject'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'plan' =>'required',
|
||||
'name' => 'required|unique:subjects,name,'.$id
|
||||
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.subject.edit',$id)
|
||||
->withErrors($validator, 'subject')
|
||||
->withInput();
|
||||
}
|
||||
$subject = Subject::addEditSubject($request,$id);
|
||||
if($subject){
|
||||
return redirect()->route('admin.subject')->with("success","Subject update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.subject.edit',$id)->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$test = Test::where('subject_id',$request->id)->get();
|
||||
if ($test->count() == 0){
|
||||
$data = Subject::Subjectdelete($request->id);
|
||||
if($data == 1){
|
||||
echo json_encode(["status"=>1]);exit;
|
||||
}else{
|
||||
echo json_encode(["status"=>0]);exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(["status"=>2]);exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Test;
|
||||
use App\Models\Subject;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('admin.test.index');
|
||||
}
|
||||
|
||||
public function getTestList(Request $request)
|
||||
{
|
||||
return Test::getTestList($request);
|
||||
}
|
||||
public function create(Request $request)
|
||||
{
|
||||
$subject = Subject::all();
|
||||
return view('admin.test.create',compact('subject'));
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subject' => 'required',
|
||||
'name' => 'required|unique:test,name',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.test.add')
|
||||
->withErrors($validator, 'test')
|
||||
->withInput();
|
||||
}
|
||||
$test = Test::addEditTest($request);
|
||||
if ($test) {
|
||||
return redirect()->route('admin.test')->with("success", "Test add Successfully!");
|
||||
} else {
|
||||
return redirect()->route('admin.add-test')->with("error", "Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$subject = Subject::all();
|
||||
$test = Test::find($id);
|
||||
return view('admin.test.edit', compact('subject','test'));
|
||||
}
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subject' => 'required',
|
||||
'name' => 'required|unique:test,name,' . $id,
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.test.edit', $id)
|
||||
->withErrors($validator, 'test')
|
||||
->withInput();
|
||||
}
|
||||
$test = Test::addEditTest($request, $id);
|
||||
if ($test) {
|
||||
return redirect()->route('admin.test')->with("success", "Test update Successfully!");
|
||||
} else {
|
||||
return redirect()->route('admin.test.edit', $id)->with("error", "Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$data = Test::testdelete($request->id);
|
||||
if ($data == 1) {
|
||||
echo json_encode(["status" => 1]);
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(["status" => 0]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\TestQuestion;
|
||||
use App\Models\Test;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class TestQuestionController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
return view('admin.test_question.index');
|
||||
}
|
||||
|
||||
public function getQuestionList(Request $request){
|
||||
return TestQuestion::getQuestionList($request);
|
||||
}
|
||||
public function create(Request $request){
|
||||
$test = TestQuestion::get_TestList();
|
||||
return view('admin.test_question.create',compact('test'));
|
||||
}
|
||||
|
||||
function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'test' =>'required',
|
||||
'question' => 'required|unique:test_question,question',
|
||||
'option_1' => 'required|unique:test_question,option_1',
|
||||
'option_2' => 'required|unique:test_question,option_2',
|
||||
'option_3' => 'required|unique:test_question,option_2',
|
||||
'option_4' => 'required|unique:test_question,option_2',
|
||||
'true_answer' => 'required|unique:test_question,true_answer',
|
||||
'solution' => 'required|unique:test_question,solution',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect('admin/add-question')
|
||||
->withErrors($validator, 'testquestion')
|
||||
->withInput();
|
||||
}
|
||||
$question = TestQuestion::addEditTestQuestion($request);
|
||||
if($question){
|
||||
return redirect()->route('admin.question')->with("success","Test Question add Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.add-question')->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
$test = TestQuestion::get_TestList();
|
||||
$state = TestQuestion::find($id);
|
||||
return view('admin.test_question.edit',compact('country','state'));
|
||||
}
|
||||
|
||||
public function update(Request $request,$id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'test' =>'required',
|
||||
'question' => 'required|unique:test_question,question',
|
||||
'option_1' => 'required|unique:test_question,option_1',
|
||||
'option_2' => 'required|unique:test_question,option_2',
|
||||
'option_3' => 'required|unique:test_question,option_2',
|
||||
'option_4' => 'required|unique:test_question,option_2',
|
||||
'true_answer' => 'required|unique:test_question,true_answer',
|
||||
'solution' => 'required|unique:test_question,solution',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.state.edit',$id)
|
||||
->withErrors($validator, 'state')
|
||||
->withInput();
|
||||
}
|
||||
$question = TestQuestion::addEditTestQuestion($request,$id);
|
||||
if($question){
|
||||
return redirect()->route('admin.state')->with("success","Test Question update Successfully!");
|
||||
}else{
|
||||
return redirect()->route('admin.state.edit',$id)->with("error","Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$data = TestQuestion::Statedelete($request->id);
|
||||
if($data == 1){
|
||||
return Response::json(["status"=>true],200);
|
||||
}else{
|
||||
return Response::json(["status"=>false],500);
|
||||
}
|
||||
|
||||
}
|
||||
public function show($id){
|
||||
$testquestion = TestQuestion::find($id);
|
||||
return view('admin.test_question.show',compact('testquestion'));
|
||||
}
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\front;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/* Login / Register Page */
|
||||
public function login()
|
||||
{
|
||||
return view('front.login');
|
||||
}
|
||||
|
||||
/* Login */
|
||||
public function postlogin(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|email|max:255',
|
||||
'password' => 'required|min:8',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect('front.login')
|
||||
->withErrors($validator, 'login')
|
||||
->withInput();
|
||||
}
|
||||
|
||||
if (Auth::attempt($request->only('email', 'password'))) {
|
||||
$user = Auth::user();
|
||||
if ($user->role != config('const.studentRole')) {
|
||||
return redirect()->route('front.login')->with("error", "You are not authorized user.");
|
||||
}
|
||||
return redirect()->route('front.dashboard');
|
||||
} else {
|
||||
return redirect()->route('front.login')->with("error", "Invalid Email Or Password.");
|
||||
}
|
||||
}
|
||||
|
||||
/* Regisert */
|
||||
public function register(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|max:100',
|
||||
'email' => 'required|unique:users,email|max:190',
|
||||
'password' => 'required|confirmed',
|
||||
'password_confirmation' => 'required|same:password'
|
||||
]);
|
||||
$message = array(
|
||||
'password.confirmed' => 'Password and Confirm Password doesnot match.'
|
||||
);
|
||||
if ($validator->fails($message)) {
|
||||
return redirect()->route('front.login')
|
||||
->withErrors($validator, 'register')
|
||||
->withInput();
|
||||
}
|
||||
$user = User::where('email', $request->email)->count();
|
||||
if ($user > 0) {
|
||||
return redirect()->route('front.login')->with("error", "Email is already registered.");
|
||||
}
|
||||
$user = User::register($request);
|
||||
if ($user) {
|
||||
return redirect()->route('front.login')->with("success", "You are Register Successfully!");
|
||||
} else {
|
||||
return redirect()->route('front.login')->with("error", "Some thing went wrong!");
|
||||
}
|
||||
}
|
||||
|
||||
/*Logout*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->regenerateToken();
|
||||
return redirect()->route('front.login');
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\front;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\User;
|
||||
|
||||
|
||||
class FrontHomeController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
return view('front.index');
|
||||
}
|
||||
|
||||
/* Student Dashboard */
|
||||
public function dashboard(){
|
||||
return view('front.dahsboard');
|
||||
}
|
||||
/* Student Profile */
|
||||
public function profile(){
|
||||
return view('front.profile');
|
||||
}
|
||||
/* Student Change Password */
|
||||
public function changepassword(){
|
||||
return view('front.changepassword');
|
||||
}
|
||||
|
||||
/*
|
||||
* Update User Password
|
||||
*/
|
||||
|
||||
public function updatePassword(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'currentpassword' => 'required|max:255',
|
||||
'password' => 'required|max:255',
|
||||
'password_confirmation' => 'required|max:255|same:password',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('front.changepassword')->withErrors($validator, 'changepassword')->withInput();
|
||||
}
|
||||
if (!Hash::check($request->currentpassword, Auth::user()->password)) {
|
||||
return redirect()->route('front.changepassword')->with('error', 'Password and Current Password does not match.');
|
||||
}
|
||||
if ($request->newpassword != $request->confirmpassword) {
|
||||
return redirect()->route('front.changepassword')->with('error', 'New Password and Confirm Password does not match.');
|
||||
}
|
||||
User::updatePassword($request, Auth::user()->id);
|
||||
return redirect()->route('front.changepassword')->with('success', 'Password Change Successfully!');
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'prevent-back-history' => \App\Http\Middleware\PreventBackHistory::class,
|
||||
];
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PreventBackHistory {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next) {
|
||||
$response = $next($request);
|
||||
return $response->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate')
|
||||
->header('Pragma', 'no-cache')
|
||||
->header('Expires', 'Sun, 02 Jan 1990 00:00:00 GMT');
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Sendmail;
|
||||
|
||||
class SendEmailJob implements ShouldQueue {
|
||||
|
||||
use Dispatchable,
|
||||
InteractsWithQueue,
|
||||
Queueable,
|
||||
SerializesModels;
|
||||
|
||||
protected $event;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($event) {
|
||||
$this->event = $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build() {
|
||||
return $this->subject('Mail from ItSolutionStuff.com')->view('mail.forgot');
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle() {
|
||||
$event = $this->event;
|
||||
Mail::send('mail.' . $this->event['_blade'], $event, function ($message) use ($event) {
|
||||
$message->to($event['toemail'], env('APP_NAME'));
|
||||
$message->subject('Forgot Password');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Sendmail extends Mailable {
|
||||
|
||||
use Queueable,
|
||||
SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Envelope
|
||||
*/
|
||||
public function envelope() {
|
||||
return new Envelope(
|
||||
subject: 'Sendmail',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*
|
||||
* @return \Illuminate\Mail\Mailables\Content
|
||||
*/
|
||||
public function content() {
|
||||
return new Content(
|
||||
view: 'view.name',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attachments() {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use PHPUnit\Framework\Constraint\Count;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use App\Models\State;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class Country extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = "country";
|
||||
|
||||
public static function getCountryList($request)
|
||||
{
|
||||
|
||||
if ($request->ajax()) {
|
||||
$data = Country::orderBy('id','desc');
|
||||
return DataTables::of($data)
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route("admin.country.edit", $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_counntry" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit Country */
|
||||
public static function addEditCountry($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = Country::find($id);
|
||||
} else {
|
||||
$data = new Country();
|
||||
}
|
||||
$data->name = $request->name;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete Country */
|
||||
public static function countrydelete($id)
|
||||
{
|
||||
Country::where('id', $id)->delete();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get Country List */
|
||||
public static function get_CountryList()
|
||||
{
|
||||
return Country::all();
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use App\Models\Country;
|
||||
use App\Models\State;
|
||||
use App\Models\ExamCategory;
|
||||
|
||||
class Exam extends Model {
|
||||
|
||||
use HasFactory,
|
||||
SoftDeletes;
|
||||
|
||||
protected $table = 'exam';
|
||||
|
||||
public function getCountry() {
|
||||
return $this->hasOne(Country::class, 'id', 'country_id');
|
||||
}
|
||||
|
||||
public function getState() {
|
||||
return $this->hasOne(State::class, 'id', 'state_id');
|
||||
}
|
||||
|
||||
public function getExamCategory() {
|
||||
return $this->hasOne(ExamCategory::class, 'id', 'exam_category_id');
|
||||
}
|
||||
|
||||
public static function getExamList($request) {
|
||||
if ($request->ajax()) {
|
||||
$data = Exam::with(['getCountry', 'getState', 'getExamCategory']);
|
||||
if ($request->order) {
|
||||
$data->orderBy('id', 'desc');
|
||||
}
|
||||
return DataTables::of($data)
|
||||
->addColumn('country', function ($row) {
|
||||
return $row->getCountry->name;
|
||||
})
|
||||
->addColumn('state', function ($row) {
|
||||
return $row->getState->name;
|
||||
})
|
||||
->addColumn('category', function ($row) {
|
||||
return $row->getExamCategory->title;
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.exam.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_exam" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add Edit Country */
|
||||
|
||||
public static function addEditExam($request, $id = '') {
|
||||
if ($id) {
|
||||
$data = Exam::find($id);
|
||||
} else {
|
||||
$data = new Exam();
|
||||
}
|
||||
$data->exam_category_id = $request->examcategory;
|
||||
$data->country_id = $request->country;
|
||||
$data->state_id = $request->state;
|
||||
$data->name = $request->name;
|
||||
$data->description = $request->description;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete Exam */
|
||||
|
||||
public static function Examdelete($id) {
|
||||
Exam::where('id', $id)->delete();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use App\Models\Exam;
|
||||
|
||||
class ExamCategory extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = "exam_category";
|
||||
public static function getExamCategoryList($request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = ExamCategory::orderBy('id', 'desc');
|
||||
return DataTables::of($data)
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.examcategory.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_examcategory" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit Country */
|
||||
public static function addEditExamCategory($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = ExamCategory::find($id);
|
||||
} else {
|
||||
$data = new ExamCategory();
|
||||
}
|
||||
$data->title = $request->title;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete Country */
|
||||
public static function ExamCategorydelete($id)
|
||||
{
|
||||
ExamCategory::where('id', $id)->delete();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Exam Category */
|
||||
public static function get_ExamCategoryList()
|
||||
{
|
||||
return ExamCategory::all();
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Exam;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use App\Helper\Helpers;
|
||||
|
||||
class Plan extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = 'plans';
|
||||
|
||||
public function getExam(){
|
||||
return $this->hasOne(Exam::class,'id','exam_id');
|
||||
}
|
||||
public static function getPlanList($request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Plan::with(['getExam']);
|
||||
if($request->order){
|
||||
$data->orderBy('id','desc');
|
||||
}
|
||||
return DataTables::of($data)
|
||||
->addColumn('exam', function ($row) {
|
||||
return $row->getExam->name;
|
||||
})
|
||||
->addColumn('unlimited_test_attempt', function ($row) {
|
||||
return Helpers::getunlimitedTestAttempt($row->unlimited_test_attempt);
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.plan.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_plan" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['unlimited_test_attempt','action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit Plan */
|
||||
public static function addEditPlan($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = Plan::find($id);
|
||||
} else {
|
||||
$data = new Plan();
|
||||
}
|
||||
$data->exam_id = $request->exam;
|
||||
$data->name = $request->name;
|
||||
$data->year = $request->year;
|
||||
$data->price = $request->price ;
|
||||
$data->validity = $request->validity;
|
||||
$data->unlimited_test_attempt = $request->unlimited_test_attempt;
|
||||
$data->attempt = ($request->unlimited_test_attempt == 0) ? $request->attempt : null;
|
||||
$data->description = $request->description;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete Plan */
|
||||
public static function Plandelete($id)
|
||||
{
|
||||
return Plan::where('id', $id)->delete();
|
||||
}
|
||||
|
||||
/* Get Plan List */
|
||||
public static function get_PlanList()
|
||||
{
|
||||
return Plan::all();
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ResetPassword extends Model {
|
||||
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "password_resets";
|
||||
protected $fillable = ['email', 'token'];
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use PHPUnit\Framework\Constraint\Count;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class State extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = 'state';
|
||||
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->hasOne(Country::class, 'id', 'country_id');
|
||||
}
|
||||
public static function getStateList($request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = State::with('getCountry');
|
||||
$data->orderBy('id','desc');
|
||||
return DataTables::of($data)
|
||||
->addColumn('country', function ($row) {
|
||||
return $row->getCountry->name;
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.state.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_state" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit State */
|
||||
public static function addEditState($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = State::find($id);
|
||||
} else {
|
||||
$data = new State();
|
||||
}
|
||||
$data->country_id = $request->country;
|
||||
$data->name = $request->name;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete State */
|
||||
public static function Statedelete($id)
|
||||
{
|
||||
return State::where('id', $id)->delete();
|
||||
}
|
||||
|
||||
/* Get State List */
|
||||
public static function get_StateList($country='')
|
||||
{
|
||||
return State::where('country_id', $country)->get();
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Plan;
|
||||
|
||||
class Subject extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = 'subjects';
|
||||
|
||||
public function getPlan()
|
||||
{
|
||||
return $this->hasOne(Plan::class, 'id', 'plan_id');
|
||||
}
|
||||
public static function getSubjectList($request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Subject::with('getPlan');
|
||||
$data->orderBy('id', 'desc');
|
||||
return DataTables::of($data)
|
||||
->addColumn('plan', function ($row) {
|
||||
return $row->getPlan->name;
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.subject.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_subject" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit State */
|
||||
public static function addEditSubject($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = Subject::find($id);
|
||||
} else {
|
||||
$data = new Subject();
|
||||
}
|
||||
$data->plan_id = $request->plan;
|
||||
$data->name = $request->name;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete State */
|
||||
public static function Subjectdelete($id)
|
||||
{
|
||||
return Subject::where('id', $id)->delete();
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Subject;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class Test extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
protected $table = 'test';
|
||||
public function getSubject()
|
||||
{
|
||||
return $this->hasOne(Subject::class, 'id', 'subject_id');
|
||||
}
|
||||
public static function getTestList($request)
|
||||
{
|
||||
|
||||
if ($request->ajax()) {
|
||||
$data = Test::with('getSubject');
|
||||
if ($request->order) {
|
||||
$data->orderBy('id', 'desc');
|
||||
}
|
||||
return DataTables::of($data)
|
||||
->addColumn('subject', function ($row) {
|
||||
return $row->getSubject->name;
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route("admin.test.edit", $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_test" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit Test */
|
||||
public static function addEditTest($request, $id = '')
|
||||
{
|
||||
if ($id) {
|
||||
$data = Test::find($id);
|
||||
} else {
|
||||
$data = new Test();
|
||||
}
|
||||
$data->subject_id = $request->subject;
|
||||
$data->name = $request->name;
|
||||
$data->description = $request->description;
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete Country */
|
||||
public static function testdelete($id)
|
||||
{
|
||||
Test::where('id', $id)->delete();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get Subject List */
|
||||
public static function get_SubjectList()
|
||||
{
|
||||
return Subject::all();
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Test;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class TestQuestion extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $table = 'test_question';
|
||||
|
||||
public function getTest()
|
||||
{
|
||||
return $this->hasOne(Test::class, 'id', 'test_id');
|
||||
}
|
||||
|
||||
/* Get Question List*/
|
||||
public static function getQuestionList($request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = TestQuestion::with('getTest');
|
||||
$data->orderBy('id','desc');
|
||||
return DataTables::of($data)
|
||||
->addColumn('test', function ($row) {
|
||||
return $row->getTest->name;
|
||||
})
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="' . route('admin.question.show', $row->id) . '" class="edit btn btn-primary btn-flat btn-sm"><i class="fa fa-eye"></i> </a> <a href="' . route('admin.question.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_question" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
/* Add Edit Question */
|
||||
public static function addEditTestQuestion($request, $id = ''){
|
||||
if ($id) {
|
||||
$data = TestQuestion::find($id);
|
||||
} else {
|
||||
$data = new TestQuestion();
|
||||
}
|
||||
$data->test_id = $request->test;
|
||||
$data->question = $request->question;
|
||||
$data->option_1 = $request->option_1;
|
||||
$data->option_2 = $request->option_2;
|
||||
$data->option_3 = $request->option_3;
|
||||
$data->option_4 = $request->option_4;
|
||||
$data->true_answer = $request->true_answer;
|
||||
$data->solution = $request->solution;
|
||||
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/* Delete State */
|
||||
public static function Statedelete($id){
|
||||
return TestQuestion::where('id', $id)->delete();
|
||||
}
|
||||
|
||||
/* Get Test List */
|
||||
public static function get_TestList(){
|
||||
return Test::all();
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class User extends Authenticatable {
|
||||
|
||||
use HasApiTokens,
|
||||
HasFactory,
|
||||
Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public static function updateProfile($request, $id) {
|
||||
$user = User::find($id);
|
||||
$user->name = $request->name;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
public static function updatePassword($request, $id) {
|
||||
$user = User::find($id);
|
||||
$user->password = Hash::make($request->newpassword);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/* Student Register */
|
||||
public static function register($request)
|
||||
{
|
||||
$data = new User();
|
||||
|
||||
$data->name = $request->name;
|
||||
$data->email = $request->email;
|
||||
$data->password = Hash::make($request->password);
|
||||
$data->role = config('const.studentRole');
|
||||
$data->save();
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user