This commit is contained in:
louiscklaw
2025-01-31 21:01:16 +08:00
parent fc6f79b133
commit e08987a3b3
8150 changed files with 1149383 additions and 0 deletions

2
ryankochun91735/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.7z
archive

34
ryankochun91735/PROMPT.md Normal file
View File

@@ -0,0 +1,34 @@
You are a bot that help user to:
- re-write the pre-prompt easier to understand by "GPT" engine
- reply the improved pre-prompt only
# PYTHON SIMPLE BOT
- Help user add comment to the code
- Help user figure out crises to the code
- Comment out the line that no use
- Reply user with cleaned php code in markdown format only
- do not modify function name
- simply code if possible
- add tests seperated by "Test case n" at the bottom to various input
- re-write to comply "PHP Standards Recommendations" standard
- reply me the code only in markdown format
- when user ask you with php code, just clear the code user send you before
- list the reason to the change
- show user possible error and list suggestion
- find and fix errors
can you help me to improve these pre-prompt ?
Assist the user by performing the following tasks:
- Do not change the names of functions.
- Assist users in adding comments to their Python code to explain its functionality.
- Aid users in debugging issues with their Python code.
- Comment out any unused lines of code.
- Include "Python Docstrings" at the beginning of each function to describe its purpose and arguments.
- Keep the code as simple as possible while still meeting the user's needs.
- Follow the PEP8 style guide for formatting and organization.
- Provide only the cleaned up Python code in Markdown format as a response.
- Return cleaned up Python code in Markdown format.

View File

@@ -0,0 +1,7 @@
git status .
@pause
git add .
git commit -m"update ryankochun91735,"
start git push

7
ryankochun91735/meta.md Normal file
View File

@@ -0,0 +1,7 @@
---
tags: ITE4108M
---
```
vm image store to /public/_workspace/comission-playlist/ryankochun91735
```

BIN
ryankochun91735/task1-rebuild/notes/image.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

View File

@@ -0,0 +1 @@
helloworld

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 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

View File

@@ -0,0 +1,59 @@
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=laravel
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=mailpit
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_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
// use App\Http\Requests\RegisterRequest;
use App\Models\User;
class RegisterController extends Controller
{
public function create()
{
return view('auth.register');
}
public function store()
{
$attributes = request()->validate([
'username' => 'required|max:255|min:2',
'email' => 'required|email|max:255|unique:users,email',
'password' => 'required|min:5|max:255',
'terms' => 'required'
]);
$user = User::create($attributes);
auth()->login($user);
return redirect('/dashboard');
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
use App\Models\User;
use App\Notifications\ForgotPassword;
class ResetPassword extends Controller
{
use Notifiable;
public function show()
{
return view('auth.reset-password');
}
public function routeNotificationForMail() {
return request()->email;
}
public function send(Request $request)
{
$email = $request->validate([
'email' => ['required']
]);
$user = User::where('email', $email)->first();
if ($user) {
$this->notify(new ForgotPassword($user->id));
return back()->with('succes', 'An email was send to your email address');
}
}
}

View File

@@ -0,0 +1,272 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\UserGroup;
use App\Models\UserRole;
use DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function index()
{
// $users = DB::table('users')->get();
$users = User::with([
'projects',
'items',
'orders',
'usergroups'
])->get();
$user_count = User::where('email', '!=', '')->count();
$user_roles = UserRole::all();
$user_groups = UserGroup::all();
return view(
'pages.users.index',
compact(
'users',
'user_roles',
'user_count',
'user_groups'
)
);
}
public function delete(Request $request, string $category_id)
{
try {
DB::beginTransaction();
$exam = User::find($category_id);
$exam->delete();
DB::commit();
return redirect()
->route('users.index')
->with('success', 'exam has been deleted successfully');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function create(Request $request)
{
try {
$user_roles = UserRole::all();
return view(
'pages.users.create',
compact('request', 'user_roles')
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'username' => '',
'postal' => '',
'lastname' => '',
'firstname' => '',
'address' => '',
'country' => '',
'city' => '',
'email' => '',
'password' => '',
'about' => ''
]);
// return create form
DB::beginTransaction();
$user = new User();
$user->username = $validatedData['username'];
$user->postal = $validatedData['postal'];
$user->lastname = $validatedData['lastname'];
$user->firstname = $validatedData['firstname'];
$user->address = $validatedData['address'];
$user->country = $validatedData['country'];
$user->city = $validatedData['city'];
$user->email = $validatedData['email'];
$user->about = $validatedData['about'];
$user->password = bcrypt($validatedData['password']);
$user->save();
DB::commit();
Session::forget('status');
return redirect()
->route('users.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function edit(Request $request, string $user_id)
{
try {
$user = User::where('id', $user_id)->with([
'projects',
'items',
'orders',
'usergroups'
])->first();
$user_roles = UserRole::all();
$user_groups = UserGroup::all();
// dd($user);
return view(
'pages.users.edit',
compact(
'user',
'user_groups',
'user_roles',
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function update(Request $request, string $user_id)
{
try {
$validatedData = $request->validate([
'username' => '',
'firstname' => '',
'lastname' => '',
'email' => '',
'address' => '',
'city' => '',
'country' => '',
'postal' => '',
'about' => '',
'roles' => '',
'usergroup_id' => ''
]);
DB::beginTransaction();
$user = User::find($user_id);
$user->username = $validatedData['username'];
$user->firstname = $validatedData['firstname'];
$user->lastname = $validatedData['lastname'];
$user->email = $validatedData['email'];
$user->address = $validatedData['address'];
$user->city = $validatedData['city'];
$user->country = $validatedData['country'];
$user->postal = $validatedData['postal'];
$user->about = $validatedData['about'];
$user->roles = $validatedData['roles'];
$user->save();
foreach ($user->usergroups as $user_group) {
$user->usergroups()->detach($user_group->id);
}
$user->usergroups()->attach($validatedData['usergroup_id']);
DB::commit();
Session::forget('status');
return redirect()
->route('users.index');
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function enable(Request $request, string $user_id)
{
try {
$request_all = $request->all();
DB::beginTransaction();
$user = User::find($user_id);
$user->status = 1;
$user->save();
DB::commit();
Session::forget('status');
return redirect()
->route('users.index');
} catch (\Throwable $th) {
var_dump($request_all);
echo $th->getMessage();
}
}
public function disable(Request $request, string $user_id)
{
try {
$request_all = $request->all();
DB::beginTransaction();
$user = User::find($user_id);
$user->status = 0;
$user->save();
DB::commit();
Session::forget('status');
return redirect()
->route('users.index');
} catch (\Throwable $th) {
var_dump($request_all);
echo $th->getMessage();
}
}
public function view(Request $request, string $user_id)
{
try {
$user = User::where('id', $user_id)->with(['usergroups'])->get()[0];
return view(
'pages.users.view',
compact(
'user',
'request',
)
);
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function routeShouldBeObsoleted()
{
return 'route_should_be_obsoleted';
}
}

View File

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

View File

@@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\UserRole;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
class UserProfileController extends Controller
{
public function show(Request $request)
{
$user_id = $request->user()->id;
$user = User::where('id', $user_id)->with(['projects', 'orders', 'items'])->first();
$role_id = $request->user()->roles;
$role = UserRole::where('id', $role_id)->first();
$role_name = $role->name;
$status = $request->user()->status;
$user_status = $status == 1 ? "enabled" : "disabled";
return view(
'pages.user-profile',
compact(
'user',
'role_name',
'user_status'
)
);
}
public function update(Request $request)
{
var_dump($request);
try {
$attributes = $request->validate([
'username' => ['required', 'max:255', 'min:2'],
'firstname' => ['max:100'],
'lastname' => ['max:100'],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore(auth()->user()->id),],
'address' => ['max:100'],
'city' => ['max:100'],
'country' => ['max:100'],
'postal' => ['max:100'],
'about' => ['max:255']
]);
auth()->user()->update([
'username' => $request->get('username'),
'firstname' => $request->get('firstname'),
'lastname' => $request->get('lastname'),
'email' => $request->get('email'),
'address' => $request->get('address'),
'city' => $request->get('city'),
'country' => $request->get('country'),
'postal' => $request->get('postal'),
'about' => $request->get('about')
]);
return back();
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
public function self_update(Request $request)
{
try {
$attributes = $request->validate([
'username' => ['required', 'max:255', 'min:2'],
'firstname' => ['max:100'],
'lastname' => ['max:100'],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore(auth()->user()->id),],
'address' => ['max:100'],
'city' => ['max:100'],
'country' => ['max:100'],
'postal' => ['max:100'],
'about' => ['max:255']
]);
auth()->user()->update([
'username' => $request->get('username'),
'firstname' => $request->get('firstname'),
'lastname' => $request->get('lastname'),
'email' => $request->get('email'),
'address' => $request->get('address'),
'city' => $request->get('city'),
'country' => $request->get('country'),
'postal' => $request->get('postal'),
'about' => $request->get('about')
]);
return back();
} catch (\Throwable $th) {
echo $th->getMessage();
}
}
}

View File

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

View File

@@ -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,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's middleware aliases.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'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,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : route('login');
}
}

View File

@@ -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 = [
//
];
}

View File

@@ -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 = [
//
];
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@@ -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',
];
}

View File

@@ -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(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@@ -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;
}

View File

@@ -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',
];
}

View File

@@ -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 = [
//
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_addresses';
protected $fillable = ['name', 'description'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Brand extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_brands';
protected $fillable = ['name','description'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_categories';
protected $fillable = ['name', 'description'];
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_customers';
protected $fillable = [
'name',
'email',
'description',
'sex',
'address'
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Deliveries extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_deliveries';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Discounts extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_discounts';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Helloworld extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_helloworld';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Invoices extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_invoices';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Item extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_items';
protected $fillable = ['name', 'description'];
public function locations()
{
return $this->belongsToMany('App\Models\Address', 'rel_address_item');
}
public function Brands()
{
return $this->belongsToMany('App\Models\Brand', 'rel_brand_item');
}
public function Owners()
{
return $this->belongsToMany('App\Models\User', 'rel_user_item');
}
public function Categories()
{
return $this->belongsToMany('App\Models\Category', 'rel_category_item');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_orders';
protected $fillable = ['name', 'description','amount'];
public function Projects()
{
return $this->belongsToMany('App\Models\Project', 'rel_order_project');
}
public function Owners()
{
return $this->belongsToMany('App\Models\User', 'rel_order_owner');
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OrderItems extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_order_items';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_projects';
protected $fillable = ['name', 'description'];
public function Orders()
{
return $this->belongsToMany('App\Models\Order', 'rel_order_project');
}
public function Owners()
{
return $this->belongsToMany('App\Models\User', 'rel_project_owner');
}
}

View File

@@ -0,0 +1,82 @@
<?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;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'username',
'firstname',
'lastname',
'email',
'password',
'address',
'city',
'country',
'postal',
'about'
];
/**
* 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',
];
/**
* Always encrypt the password when it is updated.
*
* @param $value
* @return string
*/
public function setPasswordAttribute($value)
{
$this->attributes['password'] = bcrypt($value);
}
public function Items()
{
return $this->belongsToMany('App\Models\Item', 'rel_user_item');
}
public function Projects()
{
return $this->belongsToMany('App\Models\Project', 'rel_project_owner');
}
public function UserGroups()
{
return $this->belongsToMany('App\Models\UserGroup', 'rel_user_user_group');
}
public function Orders()
{
return $this->belongsToMany('App\Models\Order', 'rel_order_owner');
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserGroup extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_user_groups';
protected $fillable = ['name','description'];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserRole extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $table = 'tbl_user_roles';
protected $fillable = ['name', 'description'];
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\URL;
class ForgotPassword extends Notification
{
use Queueable;
public $token;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$url = URL::temporarySignedRoute('change-password', now()->addHours(12) ,['id' => $this->token]);
return (new MailMessage)
->line('Hi!')
->subject('Reset Password')
->line('You are receiving this email so you can reset the password for your account')
->action('Reset Password', $url )
->line("If you didn't request this, please ignore this email.")
->line('Thank you!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
//
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
//
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class Alert extends Component
{
public $type;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($type)
{
$this->type = $type;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.alert');
}
}

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

View File

@@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,68 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel-frontend-presets/argon": "^2.0",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.5"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,188 @@
<?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
])->toArray(),
];

View File

@@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

View File

@@ -0,0 +1,71 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

View File

@@ -0,0 +1,111 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

View File

@@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@@ -0,0 +1,151 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

View File

@@ -0,0 +1,76 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

View File

@@ -0,0 +1,54 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 12),
'verify' => true,
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
'verify' => true,
],
];

View File

@@ -0,0 +1,131 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

View File

@@ -0,0 +1,134 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => null,
// 'client' => [
// 'timeout' => 5,
// ],
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

View File

@@ -0,0 +1,109 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

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