This commit is contained in:
louiscklaw
2025-01-31 21:09:49 +08:00
parent 130daf5bae
commit 653422de08
1475 changed files with 330350 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -ex
pushd ./example-app
# composer update
composer install
# clear-compiled Remove the compiled class file
php artisan clear-compiled &
# auth:clear-resets Flush expired password reset tokens
# cache:clear Flush the application cache
# config:clear Remove the configuration cache file
# event:clear Clear all cached events and listeners
# optimize:clear Remove the cached bootstrap files
# queue:clear Delete all of the jobs from the specified queue
# route:clear Remove the route cache file
php artisan route:clear &
# schedule:clear-cache Delete the cached mutex files created by scheduler
# view:clear Clear all compiled view files
php artisan view:clear &
wait
echo 'clear cache complete'
php artisan migrate:fresh --seed
php artisan serve --host 0.0.0.0
popd

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
RUN apk add nodejs npm
RUN mkdir /.npm
RUN chown -R 1000:1000 "/.npm"
# bcmath
# bz2
# calendar
# ctype
# curl
# dba
# dl_test
# dom
# enchant
# exif
# ffi
# fileinfo
# filter
# ftp
# gd
# gettext
# gmp
# hash
# iconv
# imap
# intl
# json
# ldap
# mbstring
# mysqli
# oci8
# odbc
# opcache
# pcntl
# pdo
# pdo_dblib
# pdo_firebird
# pdo_mysql
# pdo_oci
# pdo_odbc
# pdo_pgsql
# pdo_sqlite
# pgsql
# phar
# posix
# pspell
# random
# readline
# reflection
# session
# shmop
# simplexml
# snmp
# soap
# sockets
# sodium
# spl
# standard
# sysvmsg
# sysvsem
# sysvshm
# tidy
# tokenizer
# xml
# xmlreader
# xmlwriter
# xsl
# zend_test
# zip

View File

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

View File

@@ -0,0 +1,58 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=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_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,21 @@
**/cache
/.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,55 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "strict",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false,
"endOfLine": "lf",
"plugins": [
"@shufo/prettier-plugin-blade"
],
"overrides": [
{
"files": [
"*.blade.php"
],
"options": {
"printWidth": 80,
"tabWidth": 2,
"wrapAttributes": "force-expand-multiline",
"sortTailwindcssClasses": true,
"sortHtmlAttributes": "code-guide",
"noPhpSyntaxCheck": false,
"parser": "blade"
}
},
{
"files": [
"./**/*.php"
],
"options": {
"printWidth": 80,
"tabWidth": 2
}
},
{
"files": [
"./**/web.php"
],
"options": {
"printWidth": 320,
"tabWidth": 2
}
}
]
}

View File

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

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,48 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@@ -0,0 +1,498 @@
<?php
namespace App\Http\Controllers;
use DateTime;
use DateInterval;
use DatePeriod;
use PDF;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Admin;
use App\Models\Attendance;
use App\Models\ClassRoom;
use App\Models\ClassRoomActivity;
use App\Models\Exam;
use App\Models\ExamResult;
use App\Models\Payment;
use App\Models\PresentScheduleRel;
use App\Models\Schedule;
use App\Models\ScheduleSubjectRel;
use App\Models\Student;
use App\Models\Subject;
use App\Models\Teacher;
use App\Models\User;
class AdminController extends Controller
{
public function Helloworld(Request $request)
{
return view('helloworld');
}
public function index(Request $request)
{
try {
$admins = Admin::orderBy('id', 'desc')->paginate(10);
Session::forget('status');
return view('admins.index', compact('request', 'admins'));
} catch (\Exception $e) {
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function create(Request $request)
{
return view('admins.create', compact('request'));
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'firstName' => 'required',
'lastName' => 'required',
'dateOfBirth' => 'required',
'gender' => '',
'email' => 'required',
'contact' => '',
'skills' => '',
'password' => 'required',
]);
DB::beginTransaction();
$user = new User();
$user->name = join(', ', [
$validatedData['firstName'],
$validatedData['lastName'],
]);
$user->email = $validatedData['email'];
$user->password = $validatedData['password'];
$user->role = 'admin';
$user->save();
$new_user_id = $user->id;
$admin = new Admin();
$admin->firstName = $validatedData['firstName'];
$admin->lastName = $validatedData['lastName'];
$admin->dateOfBirth = $validatedData['dateOfBirth'];
if (isset($validatedData['gender'])) {
$admin->gender = $validatedData['gender'];
}
$admin->email = $validatedData['email'];
// $admin->subject_id = join(',', $validatedData['subject_id']);
if (isset($validatedData['contact'])) {
$admin->contact = $validatedData['contact'];
}
if (isset($validatedData['skills'])) {
$admin->skills = $validatedData['skills'];
}
$admin->user_id = $new_user_id;
if ($request->avatarAction == 'NO_CHANGE') {
// $teacher->avatar = NULL;
} elseif ($request->avatarAction == 'CLEAR') {
// NOTE: user intent clear avatar
$teacher->avatar = null;
} elseif ($request->avatarAction == 'UPDATE_AVATAR') {
// NOTE: user intent change avatar
$avatarFileName =
str_replace('@', '_', str_replace('.', '_', $teacher->email)) .
'.' .
$request->avatar->getClientOriginalExtension();
$request->avatar->move(public_path('avatars'), $avatarFileName);
$teacher->avatar = $avatarFileName;
}
$admin->save();
DB::commit();
Session::forget('status');
return redirect()
->route('admins.index')
->with('success', 'Admin has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
dd($e);
// TODO: no password should display error status
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('admins.edit', compact('admin', 'request'));
}
}
public function show(Request $request, Admin $admin)
{
return view('admins.show', compact('admin', 'request'));
}
public function edit(Request $request, Admin $admin)
{
return view('admins.edit', compact('request', 'admin'));
}
public function update(Request $request, Admin $admin)
{
try {
$validatedData = $request->validate([
'firstName' => 'required',
'lastName' => 'required',
'dateOfBirth' => 'required',
'gender' => '',
'email' => 'required',
'contact' => '',
'skills' => '',
]);
DB::beginTransaction();
$admin->fill($request->post())->save();
if ($request['password']) {
$user->password = $request['password'];
}
if ($request->avatarAction == 'NO_CHANGE') {
} elseif ($request->avatarAction == 'CLEAR') {
// NOTE: user intent clear avatar
$admin->avatar = null;
} elseif ($request->avatarAction == 'UPDATE_AVATAR') {
// NOTE: user intent change avatar
$avatarFileName =
str_replace('@', '_', str_replace('.', '_', $admin->email)) .
'.' .
$request->avatar->getClientOriginalExtension();
$request->avatar->move(public_path('avatars'), $avatarFileName);
$admin->avatar = $avatarFileName;
}
$admin->save();
DB::commit();
return redirect()
->route('admins.index')
->with('success', 'Admin Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('admins.edit', compact('admin', 'request'));
}
}
public function destroy(Request $request, Admin $admin)
{
try {
DB::beginTransaction();
$admin_id = $admin->id;
$admin = Admin::find($admin_id);
$user_id = $admin->user_id;
$user = User::find($user_id);
$admin->delete();
if ($user) {
$user->delete();
}
DB::commit();
return redirect()
->route('admins.index')
->with('success', 'admin has been deleted successfully');
} catch (\Exception $e) {
DB::rollback();
dd($e);
return 'delete admin failed';
}
return redirect()
->route('admins.index')
->with('success', 'Admin has been deleted successfully');
}
public function showDashboard(Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_user = Admin::where('email', $email_to_find)->get()[0];
$num_of_schedule = Schedule::count();
$num_of_student = Student::count();
$num_of_teacher = Teacher::count();
$num_of_exam = 0;
$num_of_classroom = 0;
$num_of_subject = 0;
return view(
'admins.showDashboard',
compact(
'request',
'num_of_student',
'num_of_teacher',
'num_of_classroom',
'num_of_subject',
'num_of_schedule',
'current_user'
)
);
} catch (\Exception $e) {
return redirect()->route('login');
}
}
public function dtGetAdmins(Request $request)
{
$admins = Admin::select(['id', 'firstName', 'lastName', 'gender', 'email']);
return DataTables::eloquent($admins)->toJson();
}
public function showPayments(Request $request)
{
try {
$email_to_find = $request->user()->email;
// $current_admin = Admin::where('email', $email_to_find)
// ->get()[0];
return view('admins.showPayments', compact('request'));
} catch (\Exception $e) {
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function viewPayments(Request $request, string $payment_id)
{
try {
$email_to_find = $request->user()->email;
$current_admin = Admin::where('email', $email_to_find)->get()[0];
$payment = Payment::find($payment_id);
return view('admins.viewPayments', compact('request', 'payment'));
} catch (\Exception $e) {
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function editPayments(Request $request, string $payment_id)
{
try {
$email_to_find = $request->user()->email;
$current_admin = Admin::where('email', $email_to_find)->get()[0];
$payment = Payment::find($payment_id);
return view(
'admins.editPayments',
compact('request', 'payment', 'payment_id')
);
} catch (\Exception $e) {
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'edit admins failed';
}
}
public function storePayment(Request $request)
{
try {
$validatedData = $request->validate([
'date' => 'required',
'student_id' => 'required',
'subject' => 'required',
'amount' => 'required',
'remarks' => '',
]);
$email_to_find = $request->user()->email;
// $current_admin = Admin::where('email', $email_to_find)
// ->get()[0];
DB::beginTransaction();
$payment = new Payment();
$payment->date = $validatedData['date'];
$payment->student_id = $validatedData['student_id'];
$payment->subject = $validatedData['subject'];
$payment->amount = $validatedData['amount'];
$payment->remarks = $validatedData['remarks'];
$payment->save();
Session::forget('status');
DB::commit();
return redirect()
->route('adminShowPayments')
->with('success', 'Payment has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function updatePayment(Request $request, string $payment_id)
{
try {
$email_to_find = $request->user()->email;
$current_admin = Admin::where('email', $email_to_find)->get()[0];
DB::beginTransaction();
$validatedData = $request->validate([
'date' => 'required',
'student_id' => 'required',
'subject' => 'required',
'amount' => 'required',
'remarks' => '',
]);
$payment = Payment::find($payment_id);
$payment->date = $validatedData['date'];
$payment->student_id = $validatedData['student_id'];
$payment->subject = $validatedData['subject'];
$payment->amount = $validatedData['amount'];
$payment->remarks = $validatedData['remarks'];
$payment->save();
DB::commit();
Session::forget('status');
return view('admins.showPayments', compact('request', 'payment'));
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function adminDeletePayment(Request $request, string $payment_id)
{
try {
$email_to_find = $request->user()->email;
$current_admin = Admin::where('email', $email_to_find)->get()[0];
DB::beginTransaction();
$payment = Payment::find($payment_id);
$payment->delete();
DB::commit();
Session::forget('status');
return view('admins.showPayments', compact('request', 'payment'));
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
public function createPayment(Request $request)
{
try {
return view('admins.createPayment', compact('request'));
} catch (\Exception $e) {
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'create payment failed';
}
}
public function printPayment(Request $request, string $payment_id)
{
try {
$email_to_find = $request->user()->email;
$current_admin = Admin::where('email', $email_to_find)->get()[0];
$payment = Payment::find($payment_id);
$student = Student::where('email', '=', 'student1@school.com')->get()[0];
// $pdf = PDF::loadHTML('<h1>Test</h1>');
$pdf = PDF::loadView('invoice', compact('payment', 'student'));
// $pdf = PDF::loadFile(public_path().'/myfile.html');
// return Pdf::loadFile(public_path().'/myfile.html')
// ->save('/path-to/my_stored_file.pdf')
// ->stream('download.pdf');
// $pdf = PDF::loadFile(public_path().'/myfile.html');
return $pdf->stream();
dd($payment);
// return view('admins.work_in_progress');
return 'hello admin controller';
} catch (\Exception $e) {
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list admins failed';
}
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers;
use App\Models\Apple;
use Illuminate\Http\Request;
class AppleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$apples = Apple::orderBy('id', 'desc')->paginate(10);
return view('apples.index', compact('apples'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('apples.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
Apple::create($request->post());
return redirect()
->route('apples.index')
->with('success', 'Apple has been created successfully.');
}
/**
* Display the specified resource.
*
* @param \App\Apple $Apple
* @return \Illuminate\Http\Response
*/
public function show(Apple $apple)
{
return view('apples.show', compact('apple'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Apple $Apple
* @return \Illuminate\Http\Response
*/
public function edit(Apple $apple)
{
return view('apples.edit', compact('apples'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Apple $Apple
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Apple $Apple)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
$Apple->fill($request->post())->save();
return redirect()
->route('apples.index')
->with('success', 'Apple Has Been updated successfully');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Apple $Apple
* @return \Illuminate\Http\Response
*/
public function destroy(Apple $Apple)
{
$Apple->delete();
return redirect()
->route('apples.index')
->with('success', 'Apple has been deleted successfully');
}
}

View File

@@ -0,0 +1,180 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Attendance;
use App\Models\Student;
use App\Models\Subject;
class attendanceController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
return view('attendances.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list attendance failed';
}
}
}
public function getAttendancesJson()
{
try {
$arr = [];
$attendances = Attendance::orderBy('id', 'asc')->paginate(100);
foreach ($attendances as $row) {
array_push($arr, [
'check_time' => $row->check_time,
'student_email' => $row->student_email,
'subject_id' => $row->subject_id,
]);
}
return response()->json($arr);
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list attendance failed';
}
}
}
public function show(Attendance $attendance, Request $request)
{
try {
return view('attendances.show', compact('attendance', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but show attendance failed';
}
}
}
public function edit(Attendance $attendance, Request $request)
{
try {
return view('attendances.edit', compact('attendance', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but edit attendance failed';
}
}
}
public function update(Request $request, Attendance $attendance)
{
try {
$validatedData = $request->validate([
'student_id' => 'required',
'subject_id' => 'required',
'remarks' => '',
]);
$attendance->fill($request->post())->save();
return view('attendances.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list attendance failed';
}
}
}
public function destroy(Attendance $attendance)
{
try {
$attendance->delete();
return redirect()
->route('attendances.index')
->with('success', 'attendance has been deleted successfully');
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
$ERR_MSG = 'delete classroom failed';
return $ERR_MSG;
}
}
}
public function dtGetAttendances()
{
try {
$attendances = Attendance::with(['subject', 'student'])->select();
return DataTables::eloquent($attendances)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list attendance failed';
}
}
}
public function create(Request $request)
{
try {
return view('attendances.create', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'create attendances failed';
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'check_time' => 'required',
'student_id' => 'required',
'subject_id' => 'required',
'remarks' => '',
]);
$attendance = new Attendance();
$attendance->check_time = $validatedData['check_time'];
$attendance->student_id = $validatedData['student_id'];
$attendance->subject_id = $validatedData['subject_id'];
$attendance->remarks = $validatedData['remarks'];
$attendance->save();
return view('attendances.index', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'create attendances failed';
}
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use App\Models\Schedule;
use App\Models\ClassRoomActivity;
use App\Models\ClassRoom;
class ClassRoomActivityController extends Controller
{
public function createClassRoomActivity(Request $request)
{
try {
$data = $request->all();
$classRoomActivity = new ClassRoomActivity();
$result = $classRoomActivity->createClassRoomActivity($data);
if ($result) {
// return response()->json(['status' => 'success']);
$schedules = Schedule::orderBy('id', 'desc')->paginate(10);
return view('schedules.index', compact('request', 'schedules'));
} else {
return response()->json(['status' => 'error']);
}
} catch (\Exception $e) {
dd($e);
return 'createClassRoomActivity failed';
}
}
public function listAllClassRoom()
{
try {
// $classrooms = ClassRoom::orderBy('id','asc');
$classRoomsResult = DB::table('class_rooms')->get();
$classRooms = [];
foreach ($classRoomsResult as $classRoom) {
array_push($classRooms, $classRoom);
}
return $classRooms;
} catch (\Exception $e) {
dd($e);
return 'list all classroom failed';
}
}
public function listFreeClassRoom(Request $request)
{
try {
$data = $request->all();
$startTime = $data['startTime'];
$endTime = $data['endTime'];
$startEpoch = strtotime($startTime);
$endEpoch = strtotime($endTime);
$arr = [];
$output = [];
if (is_null($request->query('q'))) {
// NOTE: return all records
$all_free_class_room_in_period = DB::table('class_rooms')
->whereNotIn('id', function ($query) use ($startEpoch, $endEpoch) {
$query
->select('class_room_id')
->from('class_room_activities')
->where('date_epoch', '>=', $startEpoch)
->orWhere('date_epoch', '<=', $endEpoch);
})
->get()
->unique('id');
} else {
// NOTE: request with query word
$q_word = $request->query('q');
$all_free_class_room_in_period = DB::table('class_rooms')
->where('classroomTitle', 'LIKE', '%' . $q_word . '%')
->whereNotIn('id', function ($query) use ($startEpoch, $endEpoch) {
$query
->select('class_room_id')
->from('class_room_activities')
->where('date_epoch', '>=', $startEpoch)
->orWhere('date_epoch', '<=', $endEpoch);
})
->get()
->unique('id');
}
foreach ($all_free_class_room_in_period as $free_class_room) {
array_push($output, $free_class_room);
}
return response()->json($output);
} catch (\Exception $e) {
dd($e);
return 'listFreeClassRoom failed';
}
}
}

View File

@@ -0,0 +1,258 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\ClassRoom;
class ClassRoomController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
return view('classrooms.index', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'list classroom failed';
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
try {
return view('classrooms.create', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'create classrooms failed';
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'classRoomTitle' => 'required',
'location' => 'required',
'capacity' => 'required',
]);
// ClassRoom::create($request->post());
// Subject::create($request->post());
$class_room = new ClassRoom();
$class_room->classRoomTitle = $validatedData['classRoomTitle'];
$class_room->location = $validatedData['location'];
$class_room->capacity = $validatedData['capacity'];
$class_room->save();
Session::forget('status');
return redirect()
->route('classrooms.index')
->with('success', 'ClassRoom has been created successfully.');
} catch (\Exception $e) {
// dd($e);
DB::rollback();
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('classrooms.create', compact('request'));
// return 'save classrooms failed';
}
}
/**
* Display the specified resource.
*
* @param \App\ClassRoom $classroom
* @return \Illuminate\Http\Response
*/
public function show(ClassRoom $classroom, Request $request)
{
try {
return view('classrooms.show', compact('classroom', 'request'));
} catch (\Exception $e) {
dd($e);
return 'show classroom failed';
}
}
/**
* Show the form for editing the specified resource.
*
* @param \App\ClassRoom $classroom
* @return \Illuminate\Http\Response
*/
public function edit(ClassRoom $classroom, Request $request)
{
try {
return view('classrooms.edit', compact('classroom', 'request'));
} catch (\Exception $e) {
dd($e);
return 'edit classroom failed';
}
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\ClassRoom $classroom
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ClassRoom $classroom)
{
try {
$validatedData = $request->validate([
'classRoomTitle' => 'required',
'location' => 'required',
'capacity' => 'required',
]);
$classroom->fill($request->post())->save();
Classroom::where('id', $classroom->id)->update([
'classRoomTitle' => $validatedData['classRoomTitle'],
'location' => $validatedData['location'],
'capacity' => $validatedData['capacity'],
]);
Session::forget('status');
return redirect()
->route('classrooms.index')
->with('success', 'ClassRoom Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('classrooms.edit', compact('classroom', 'request'));
// return 'update classroom failed';
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\ClassRoom $classroom
* @return \Illuminate\Http\Response
*/
public function destroy(ClassRoom $classroom)
{
try {
$classroom->delete();
return redirect()
->route('classrooms.index')
->with('success', 'ClassRoom has been deleted successfully');
} catch (\Exception $e) {
dd($e);
return 'delete classroom failed';
}
}
public function getClassRoomsJson(Request $request)
{
try {
$arr = [];
if (is_null($request->search) == true) {
$search = $request->search;
$classrooms = ClassRoom::where('deleted', '=', 'false')
->orderBy('id', 'asc')
->paginate(100);
foreach ($classrooms as $row) {
array_push($arr, [
// "name" => $row->name,
'id' => $row->id,
'classRoomId' => $row->classRoomId,
'classRoomTitle' => $row->classRoomTitle,
'location' => $row->location,
'capacity' => $row->capacity,
]);
}
return response()->json($arr);
} else {
$search = $request->search;
$classrooms = ClassRoom::where('deleted', '=', 'false')
->where('name', 'like', "%{$search}%")
->get();
foreach ($classrooms as $row) {
array_push($arr, [
// "name" => $row->name,
'id' => $row->id,
'classRoomId' => $row->classRoomId,
'classRoomTitle' => $row->classRoomTitle,
'location' => $row->location,
'capacity' => $row->capacity,
]);
}
}
return response()->json($arr);
} catch (\Exception $e) {
dd($e);
return 'getClassRoomsJson failed';
}
}
public function dtGetClassrooms()
{
$classrooms = ClassRoom::select([
'id',
'classRoomTitle',
'location',
'capacity',
])->where('deleted', '=', 'false');
return DataTables::eloquent($classrooms)->toJson();
}
public function SoftDelete(Request $request, string $id)
{
// to prevent the delete alter the schedules assigned
try {
Classroom::where('id', $id)->update([
'deleted' => 'true',
]);
return redirect()
->route('classrooms.index')
->with('success', 'ClassRoom Has Been updated successfully');
} catch (\Exception $e) {
return redirect()
->route('classrooms.index')
->with('failed', 'failed during delete classrooms');
}
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers;
use App\Models\Company;
use Illuminate\Http\Request;
class CompanyController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$companies = Company::orderBy('id', 'desc')->paginate(10);
return view('companies.index', compact('companies'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('companies.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
Company::create($request->post());
return redirect()
->route('companies.index')
->with('success', 'Company has been created successfully.');
}
/**
* Display the specified resource.
*
* @param \App\company $company
* @return \Illuminate\Http\Response
*/
public function show(Company $company)
{
return view('companies.show', compact('company'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function edit(Company $company)
{
return view('companies.edit', compact('company'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\company $company
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Company $company)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
$company->fill($request->post())->save();
return redirect()
->route('companies.index')
->with('success', 'Company Has Been updated successfully');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Company $company
* @return \Illuminate\Http\Response
*/
public function destroy(Company $company)
{
$company->delete();
return redirect()
->route('companies.index')
->with('success', 'Company has been deleted successfully');
}
}

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,74 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Student;
use App\Models\Teacher;
use App\Models\Admin;
use App\Models\User;
use App\Models\ClassRoom;
use App\Models\Subject;
use App\Models\Schedule;
class DashboardController extends Controller
{
public function index(Request $request)
{
try {
$num_of_student = Student::count();
$num_of_teacher = Teacher::count();
$num_of_classroom = ClassRoom::where('deleted', 'false')->count();
$num_of_subject = Subject::where('deleted', 'false')->count();
$num_of_schedule = Schedule::count();
$user_role = $request->user()->role;
$user_email = $request->user()->email;
if ($user_role == 'student') {
$student = Student::where('email', '=', $user_email)->get();
$current_student = $student[0];
$studentId = $current_student->id;
return redirect()->route('studentShowDashboard');
} elseif ($user_role == 'teacher') {
$teacher = Teacher::where('email', '=', $user_email)->get();
$current_teacher = $teacher[0];
$teacherId = $current_teacher->id;
return redirect()->route('teacherShowDashboard');
} elseif ($user_role == 'admin') {
$admin = Admin::where('email', '=', $user_email)->get();
$current_admin = $admin[0];
$adminId = $current_admin->id;
return redirect()->route('showAdminDashboard');
} elseif ($user_role == 'debug') {
// NOTE: debug user fall here
$user = User::where('email', '=', $user_email)->get();
$current_user = $user[0];
return view(
'dashboard.index',
compact(
'request',
'num_of_student',
'num_of_teacher',
'num_of_classroom',
'num_of_subject',
'num_of_schedule',
'current_user'
)
);
} else {
// NOTE: should not see me
}
} catch (\Exception $e) {
dd($e);
header_remove();
return redirect('/sign-in');
}
}
}

View File

@@ -0,0 +1,251 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Exam;
use App\Models\Student;
use App\Models\Teacher;
class ExamController extends Controller
{
function returnToLogin()
{
return redirect()
->route('login')
->with('success', 'sorry but the session already timeout');
}
function errHandler($th)
{
$ERR_CANNOT_GET_EMAIL = 'Attempt to read property "email" on null';
if ($ERR_CANNOT_GET_EMAIL == $th->getMessage()) {
return $this->returnToLogin();
} else {
throw dd($th);
}
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
return view('exams.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam failed';
}
}
}
public function getExamsJson(Request $request)
{
try {
$arr = [];
if (is_null($request->query('q'))) {
// NOTE: return all records
$exams = Exam::all();
} else {
// NOTE: request with query word
$q_word = $request->query('q');
$exams = Exam::where('title', 'LIKE', '%' . $q_word . '%')->get();
}
foreach ($exams as $row) {
array_push($arr, [
'id' => $row->id,
'date' => $row->date,
'subject_id' => $row->subject_id,
'title' => $row->title,
'remarks' => $row->remarks,
]);
}
return response()->json($arr);
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam failed';
}
}
}
public function show(Exam $exam, Request $request)
{
try {
$exam = Exam::with(['subject'])->find($exam->id);
return view('exams.show', compact('exam', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but show exam failed';
}
}
}
public function edit(Exam $exam, Request $request)
{
try {
$exam = Exam::with(['subject'])->find($exam->id);
$teacher = $exam->teachers[0];
return view('exams.edit', compact('exam', 'request', 'teacher'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but edit exam failed';
}
}
}
public function destroy(Exam $exam)
{
try {
$exam_id = $exam->id;
$exam->teachers()->detach();
$exam->delete();
return redirect()
->route('exams.index')
->with('success', 'exam has been deleted successfully');
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
$ERR_MSG = 'delete classroom failed';
return $ERR_MSG;
}
}
}
public function dtGetExams()
{
try {
$exams = Exam::with(['subject'])->select();
return DataTables::eloquent($exams)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam failed';
}
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'date' => 'required',
'subject_id' => 'required',
'title' => 'required',
'teacher_id' => 'required',
'remarks' => '',
]);
$teacher = Teacher::find($validatedData['teacher_id']);
$exam_db = new Exam();
$exam_db->date = $validatedData['date'];
$exam_db->subject_id = $validatedData['subject_id'];
$exam_db->title = $validatedData['title'];
$exam_db->remarks = $validatedData['remarks'];
$exam_db->save();
$new_exam_id = $exam_db->id;
$teacher->exams()->attach($new_exam_id);
return redirect()
->route('exams.index')
->with('success', 'Exam has been created successfully.');
} catch (\Exception $e) {
return $this->errHandler($e);
}
}
public function create(Request $request)
{
try {
return view('exams.create', compact('request'));
} catch (\Exception $e) {
//throw $th;
dd($e);
return 'add new exam failed';
}
}
public function update(Request $request, Exam $exam)
{
try {
$validatedData = $request->validate([
'date' => 'required',
'subject_id' => 'required',
'title' => 'required',
'teacher_id' => 'required',
'remarks' => '',
]);
DB::beginTransaction();
$teacher = Teacher::find($validatedData['teacher_id']);
$exam_db = Exam::find($exam->id);
$exam_db->date = $validatedData['date'];
$exam_db->subject_id = $validatedData['subject_id'];
$exam_db->title = $validatedData['title'];
$exam_db->remarks = $validatedData['remarks'];
$exam_db->save();
$exam_db->teachers()->detach();
$exam_db->teachers()->attach($teacher);
DB::commit();
return redirect()
->route('exams.index')
->with('success', 'Exam has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
return $this->errHandler($e);
}
}
public function dtGetSimpleExams(Request $request)
{
$exams = Exam::with(['subject'])
->orderBy('id', 'desc')
->limit(10)
->get();
return response()->json($exams);
}
}

View File

@@ -0,0 +1,254 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\ExamResult;
use App\Models\Student;
use App\Models\Teacher;
use App\Models\Exam;
class ExamResultController extends Controller
{
function returnToLogin()
{
return redirect()
->route('login')
->with('success', 'sorry but the session already timeout');
}
function errHandler($th)
{
$ERR_CANNOT_GET_EMAIL = 'Attempt to read property "email" on null';
if ($ERR_CANNOT_GET_EMAIL == $th->getMessage()) {
return $this->returnToLogin();
} else {
throw dd($th);
}
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
return view('exam_results.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam failed';
}
}
}
public function getExamResultsJson()
{
try {
$arr = [];
$exam_results = ExamResult::orderBy('id', 'asc')->paginate(100);
foreach ($exam_results as $row) {
array_push($arr, [
'exam_id' => $row->exam_id,
'subject_id' => $row->subject_id,
'student_email' => $row->student_email,
'result' => $row->result,
'remarks' => $row->remarks,
]);
}
return response()->json($arr);
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam_results failed';
}
}
}
public function show(ExamResult $exam_result, Request $request)
{
try {
$exam_result = ExamResult::with(['exam', 'student', 'teacher'])->find(
$exam_result->id
);
return view('exam_results.show', compact('exam_result', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but show exam results failed';
}
}
}
public function edit(ExamResult $exam_result, Request $request)
{
try {
return view('exam_results.edit', compact('exam_result', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but edit exam_result failed';
}
}
}
public function destroy(ExamResult $exam_result)
{
try {
$exam_result->delete();
return redirect()
->route('exam_results.index')
->with('success', 'exam_result has been deleted successfully');
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
$ERR_MSG = 'delete classroom failed';
return $ERR_MSG;
}
}
}
public function dtGetExamResults()
{
try {
$exam_results = ExamResult::with([
'student',
'teacher',
'exam',
])->select();
return DataTables::eloquent($exam_results)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam result failed';
}
}
}
public function dtGetExamResultsByStudentEmail(
Request $request,
string $student_email
) {
try {
$exam_results = ExamResult::select()->where(
'student_email',
'=',
$student_email
);
return DataTables::eloquent($exam_results)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam result failed';
}
}
}
public function create(Request $request)
{
try {
return view('exam_results.create', compact('request'));
} catch (\Exception $e) {
//throw $th;
dd($e);
return 'add new exam failed';
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'exam_id' => 'required',
'student_id' => 'required',
'teacher_id' => 'required',
'result' => '',
]);
$exam = Exam::find($validatedData['exam_id']);
$student = Student::find($validatedData['student_id']);
$teacher = Teacher::find($validatedData['teacher_id']);
$exam_result_db = new ExamResult();
$exam_result_db->result = $validatedData['result'];
$exam_result_db->remarks = $request['remarks'];
$exam_result_db->student_id = $student->id;
$exam_result_db->teacher_id = $teacher->id;
$exam_result_db->exam_id = $exam->id;
$exam_result_db->save();
return redirect()
->route('exam_results.index')
->with('success', 'ExamResult has been created successfully.');
} catch (\Exception $e) {
dd($e);
return 'add exam result failed';
}
}
public function update(Request $request, ExamResult $exam_result)
{
try {
$validatedData = $request->validate([
'exam_id' => 'required',
'student_id' => 'required',
'teacher_id' => 'required',
'result' => '',
]);
$exam = Exam::find($validatedData['exam_id']);
$student = Student::find($validatedData['student_id']);
$teacher = Teacher::find($validatedData['teacher_id']);
$exam_result_db = ExamResult::find($exam_result->id);
$exam_result_db->result = $validatedData['result'];
$exam_result_db->remarks = $request['remarks'];
$exam_result_db->student_id = $student->id;
$exam_result_db->teacher_id = $teacher->id;
$exam_result_db->exam_id = $exam->id;
$exam_result_db->save();
return redirect()
->route('exam_results.index')
->with('success', 'ExamResult has been updated successfully.');
} catch (\Exception $e) {
return $this->errHandler($e);
}
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers;
use App\Models\Student;
use App\Models\Exam;
use App\Models\Subject;
use App\Models\ExamResult;
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,165 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Notice;
use App\Models\Student;
class NoticeController extends Controller
{
public function index(Request $request)
{
Session::forget('status');
try {
return view('notices.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list notice failed';
}
}
}
public function dtGetNotices()
{
try {
$notices = Notice::select(['id', 'date', 'subject', 'content']);
return DataTables::eloquent($notices)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list notice failed';
}
}
}
public function getStudentUnreadNoticesCount(
Request $request,
string $student_id
) {
$already_read_notices = DB::select(
'select notice_id from `notice_student_rel` where student_id = ?',
[$student_id]
);
$already_read_ids = [];
foreach ($already_read_notices as $already_read_notice) {
array_push($already_read_ids, $already_read_notice->notice_id);
}
$all_unread_notices = Notice::select(['id', 'date', 'subject', 'content'])
->whereNotIn('id', $already_read_ids)
->count();
return json_encode(['unread' => $all_unread_notices]);
}
public function dtGetStudentUnreadNotices(
Request $request,
string $student_id
) {
try {
$current_student = Student::find($student_id);
$student_all_notice = Notice::where(
'to',
'=',
$current_student->email
)->get();
$already_read_notices = DB::select(
'select notice_id from `notice_student_rel` where student_id = ?',
[$student_id]
);
$already_read_ids = [];
foreach ($already_read_notices as $already_read_notice) {
array_push($already_read_ids, $already_read_notice->notice_id);
}
$all_unread_notices = Notice::select(['id', 'date', 'subject', 'content'])
->where('to', '=', $current_student->email)
->whereNotIn('id', $already_read_ids);
return DataTables::eloquent($all_unread_notices)->toJson();
} catch (\Exception $e) {
dd($e);
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list notice failed';
}
}
}
public function show(Notice $notice, Request $request)
{
try {
return view('notices.show', compact('notice', 'request'));
} catch (\Exception $e) {
dd($e);
return 'show notice failed';
}
}
public function edit(Notice $notice, Request $request)
{
try {
return view('notices.edit', compact('notice', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but edit notice failed';
}
}
}
public function destroy(Notice $notice)
{
try {
$notice->delete();
return redirect()
->route('notices.index')
->with('success', 'notice has been deleted successfully');
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'create notices failed';
}
}
}
public function create(Request $request)
{
try {
return view('notices.create', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'create notices failed';
}
}
}
}

View File

@@ -0,0 +1,181 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Payment;
use App\Models\Student;
class PaymentController extends Controller
{
function returnToLogin()
{
return redirect()
->route('login')
->with('success', 'sorry but the session already timeout');
}
function errHandler($th)
{
$ERR_CANNOT_GET_EMAIL = 'Attempt to read property "email" on null';
if ($ERR_CANNOT_GET_EMAIL == $th->getMessage()) {
return $this->returnToLogin();
} else {
throw dd($th);
}
}
public function create(Request $request)
{
try {
return view('payments.create', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'create payments failed';
}
}
public function index(Request $request)
{
Session::forget('status');
try {
return view('payments.index', compact('request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list payment failed';
}
}
}
public function destroy(Payment $payment)
{
$payment->delete();
return redirect()
->route('payments.index')
->with('success', 'payment has been deleted successfully');
}
public function dtGetPayments()
{
try {
$payments = Payment::with(['student'])->select();
return DataTables::eloquent($payments)->toJson();
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but list exam failed';
}
}
}
public function show(Payment $payment, Request $request)
{
try {
return view('payments.show', compact('payment', 'request'));
} catch (\Exception $e) {
dd($e);
return 'show payment failed';
}
}
public function edit(Request $request, Payment $payment)
{
try {
return view('payments.edit', compact('payment', 'request'));
} catch (\Exception $e) {
$debug = config('app.debug');
if ($debug) {
dd($e);
} else {
return 'sorry but edit payment failed';
}
}
}
public function update(Request $request, Payment $payment)
{
try {
$validatedData = $request->validate([
'date' => 'required',
'student_id' => 'required',
'subject' => 'required',
'amount' => 'required',
'remarks' => '',
]);
// $payment->fill($request->post())->save();
$payment = Payment::find($payment->id);
$payment->date = $validatedData['date'];
$payment->student_id = $validatedData['student_id'];
$payment->subject = $validatedData['subject'];
$payment->amount = $validatedData['amount'];
$payment->remarks = $validatedData['remarks'];
$payment->save();
Session::forget('status');
return redirect()
->route('payments.index')
->with('success', 'ClassRoom Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('payments.edit', compact('payment', 'request'));
}
}
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'from' => 'required',
'amount' => 'required',
]);
DB::beginTransaction();
$payment = new Payment();
$payment->from = $validatedData['from'];
$payment->subject = $validatedData['subject'];
$payment->amount = $validatedData['amount'];
$payment->remarks = $validatedData['remarks'];
$payment->save();
Session::forget('status');
DB::commit();
return redirect()
->route('adminShowPayments')
->with('success', 'Payment has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('adminShowPayments', compact('request'));
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ProfileController extends Controller
{
public function create()
{
return view('pages.profile');
}
public function update()
{
$user = request()->user();
$attributes = request()->validate([
'email' => 'required|email|unique:users,email,' . $user->id,
'name' => 'required',
'phone' => 'required|max:10',
'about' => 'required:max:150',
'location' => 'required',
]);
auth()
->user()
->update($attributes);
return back()->withStatus('Profile successfully updated.');
}
}

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\Teacher;
use App\Models\Student;
class RegisterController extends Controller
{
function returnToLogin()
{
return redirect()
->route('login')
->with('success', 'sorry but the session already timeout');
}
function errHandler($th)
{
$ERR_CANNOT_GET_EMAIL = 'Attempt to read property "email" on null';
if ($ERR_CANNOT_GET_EMAIL == $th->getMessage()) {
return $this->returnToLogin();
} else {
throw $th;
}
}
public function createTeacher()
{
return view('register.createTeacher');
}
public function createStudent()
{
return view('register.createStudent');
}
public function registerTriage()
{
return view('register.triage');
}
public function create()
{
return view('register.create');
}
public function store()
{
try {
$attributes = request()->validate([
// name = firstName
'name' => 'max:255',
'lastName' => 'max:255',
'email' => 'email|max:255|unique:users,email',
'password' => 'min:5|max:255',
'registerUserRole' => '',
]);
$register_user_role = $attributes['registerUserRole'];
if ($register_user_role == 'teacher') {
$new_user = new User();
$new_user->name = $attributes['name'];
$new_user->email = $attributes['email'];
$new_user->password = $attributes['password'];
$new_user->role = 'teacher';
$new_user->save();
$new_user_id = $new_user->id;
auth()->login($new_user);
$teacher = new Teacher();
$teacher->email = $attributes['email'];
$teacher->firstName = $attributes['name'];
$teacher->lastName = $attributes['lastName'];
$teacher->user_id = $new_user_id;
$teacher->save();
return redirect()->route('teacherShowDashboard');
} elseif ($register_user_role == 'student') {
$new_user = new User();
$new_user->name = $attributes['name'];
$new_user->email = $attributes['email'];
$new_user->password = $attributes['password'];
$new_user->role = 'student';
$new_user->save();
$new_user_id = $new_user->id;
auth()->login($new_user);
$student = new Student();
$student->email = $attributes['email'];
$student->firstName = $attributes['name'];
$student->lastName = $attributes['lastName'];
$student->user_id = $new_user_id;
$student->save();
return redirect()->route('studentShowDashboard');
} else {
return route('helloworld');
}
return route('helloworld');
} catch (\Throwable $th) {
return $this->errHandler($th);
}
}
}

View File

@@ -0,0 +1,300 @@
<?php
namespace App\Http\Controllers;
use DateTime;
use DateInterval;
use DatePeriod;
use App\Models\Schedule;
use App\Models\ClassRoom;
use App\Models\User;
use App\Models\ClassRoomActivity;
use App\Models\ScheduleSubjectRel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Yajra\DataTables\Facades\DataTables;
class ScheduleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
$schedules = Schedule::with(['classrooms', 'subjects'])->get();
return view('schedules.index', compact('request', 'schedules'));
} catch (\Exception $e) {
dd($e);
return 'list schedule failed';
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
try {
return view('schedules.create', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'create schedule failed';
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'class_room_id' => 'required',
'subject_id' => 'required',
'subject' => 'required', //TODO: rename field, change it to "name"
'startTime' => 'required',
'endTime' => 'required',
'description' => 'required',
]);
// Schedule::create($request->post());
DB::beginTransaction();
$schedule = new Schedule();
// TODO: need review
$schedule->day = '1';
// TODO: need review
$schedule->startTime = $validatedData['startTime'];
$schedule->endTime = $validatedData['endTime'];
$schedule->description = $validatedData['description'];
$schedule->subject = $validatedData['subject']; //TODO: rename field, change it to "name"
$schedule->save();
$newScheduleId = $schedule->id;
$class_room_id = $validatedData['class_room_id'];
$startTime = $validatedData['startTime'];
$endTime = $validatedData['endTime'];
// // get the days in between startTime and endTime
$begin = new DateTime($startTime);
$end = new DateTime($endTime);
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
$arr = [];
foreach ($period as $dt) {
array_push($arr, $dt->format('Y-m-d'));
}
array_push($arr, $end->format('Y-m-d'));
foreach ($arr as $day) {
$class_room_activity = new ClassRoomActivity();
$class_room_activity->class_room_id = $class_room_id;
$class_room_activity->schedule_id = $newScheduleId;
$class_room_activity->date_epoch = strtotime($day);
$class_room_activity->save();
}
$schedule_subject_rel = new ScheduleSubjectRel();
$schedule_subject_rel->subject_id = $validatedData['subject_id'];
$schedule_subject_rel->schedule_id = $newScheduleId;
$schedule_subject_rel->save();
DB::commit();
Session::forget('status');
return redirect()
->route('schedules.index')
->with('success', 'Schedule has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('schedules.create', compact('request'));
}
}
/**
* Display the specified resource.
*
* @param \App\Schedule $schedule
* @return \Illuminate\Http\Response
*/
public function show(Schedule $schedule, Request $request)
{
try {
// dd($schedule->subjects[0]->deleted);
return view('schedules.show', compact('schedule', 'request'));
} catch (\Exception $e) {
dd($e);
return 'show schedule failed';
}
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Schedule $schedule
* @return \Illuminate\Http\Response
*/
public function edit(Schedule $schedule, Request $request)
{
try {
return view('schedules.edit', compact('schedule', 'request'));
} catch (\Exception $e) {
dd($e);
return 'edit schedule failed';
}
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Schedule $schedule
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Schedule $schedule)
{
try {
$validatedData = $request->validate([
'class_room_id' => 'required',
'description' => 'required',
'subject_id' => 'required',
'subject' => 'required', //TODO: change field name to "name"
'startTime' => 'required',
'endTime' => 'required',
]);
DB::beginTransaction();
// Schedule::where('id', $schedule->id)->update([
// 'startTime' => $validatedData['startTime'],
// 'endTime' => $validatedData['endTime'],
// 'description' => $validatedData['description'],
// ]);
$schedule = Schedule::find($schedule->id);
$schedule->startTime = $validatedData['startTime'];
$schedule->endTime = $validatedData['endTime'];
$schedule->description = $validatedData['description'];
$schedule->subject = $validatedData['subject'];
$schedule->save();
$new_subject_id = $validatedData['subject_id'];
$class_room_id = $validatedData['class_room_id'];
$startTime = $validatedData['startTime'];
$endTime = $validatedData['endTime'];
$begin = new DateTime($startTime);
$end = new DateTime($endTime);
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
$arr = [];
foreach ($period as $dt) {
array_push($arr, $dt->format('Y-m-d'));
}
array_push($arr, $end->format('Y-m-d'));
// TODO: some checking here
// detach all subjects
$subjects = $schedule->subjects;
foreach ($subjects as $subject) {
$schedule->subjects()->detach($subject->id);
}
$schedule->subjects()->attach($new_subject_id);
// delete existing booking schedule-classroom
$deleted = ClassRoomActivity::where(
'schedule_id',
$schedule->id
)->delete();
foreach ($arr as $day) {
$class_room_activity = new ClassRoomActivity();
$class_room_activity->class_room_id = $class_room_id;
$class_room_activity->schedule_id = $schedule->id;
$class_room_activity->date_epoch = strtotime($day);
$class_room_activity->save();
}
// $schedule->fill($request->post())->save();
DB::commit();
Session::forget('status');
return redirect()
->route('schedules.index')
->with('success', 'Schedule Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
dd($e);
// return 'update schedule failed';
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('teachers/EditSchedule', compact('request'));
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Schedule $schedule
* @return \Illuminate\Http\Response
*/
public function destroy(Schedule $schedule)
{
try {
$schedule->delete();
return redirect()
->route('schedules.index')
->with('success', 'Schedule has been deleted successfully');
} catch (\Exception $e) {
dd($e);
return 'delete schedule failed';
}
}
public function dtGetSchedules(Request $request)
{
$schedules = Schedule::with(['classrooms', 'subjects']);
return DataTables::eloquent($schedules)->toJson();
}
public function dtGetSimpleSchedules(Request $request)
{
$schedules = Schedule::with(['classrooms', 'subjects'])
->orderBy('id', 'desc')
->limit(10)
->get();
return response()->json($schedules);
}
}

View File

@@ -0,0 +1,129 @@
<?php
namespace App\Http\Controllers;
use Str;
use Hash;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Password;
use App\Models\User;
class SessionsController extends Controller
{
public function create()
{
try {
// NOTE: switch to control text on login
// e.g. debug@school.com / debug
$show_login_hints = true;
return view('sessions.create', compact('show_login_hints'));
} catch (\Exception $e) {
if ($debug) {
dd($e);
} else {
return 'sorry but create session failed';
}
}
}
public function store()
{
$attributes = request()->validate([
'email' => 'required|email',
'password' => 'required',
]);
if (!auth()->attempt($attributes)) {
throw ValidationException::withMessages([
'email' => 'Your provided credentials could not be verified.',
]);
}
session()->regenerate();
$email_to_find = $attributes['email'];
$user = User::where('email', '=', $email_to_find)->get()[0];
$role = $user->role;
if ($role == 'debug') {
return redirect('/dashboard');
// ->route('studentShowDashboard')
// ->with('success', 'update subject selection done');
} elseif ($role == 'teacher') {
return redirect()
->route('teacherShowDashboard')
->with('success', 'update subject selection done');
} elseif ($role == 'student') {
return redirect()
->route('studentShowDashboard')
->with('success', 'update subject selection done');
} elseif ($role == 'admin') {
return redirect('/dashboard');
// ->route('showAdminDashboard')
// ->with('success', 'update subject selection done');
} else {
return redirect('/dashboard');
// ->route('studentShowDashboard')
// ->with('success', 'update subject selection done');
}
}
public function show()
{
try {
request()->validate([
'email' => 'required|email',
]);
$status = Password::sendResetLink(request()->only('email'));
return $status === Password::RESET_LINK_SENT
? back()->with(['status' => __($status)])
: back()->withErrors(['email' => __($status)]);
} catch (\Exception $e) {
dd($e);
}
}
public function update()
{
request()->validate([
'token' => 'required',
'email' => 'required|email',
'password' => 'required|min:8|confirmed',
]);
$status = Password::reset(
request()->only('email', 'password', 'password_confirmation', 'token'),
function ($user, $password) {
$user
->forceFill([
'password' => $password,
])
->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
}
);
return $status === Password::PASSWORD_RESET
? redirect()
->route('login')
->with('status', __($status))
: back()->withErrors(['email' => [__($status)]]);
}
public function destroy()
{
auth()->logout();
return redirect('/sign-in');
}
}

View File

@@ -0,0 +1,877 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Session;
use App\Models\Exam;
use App\Models\ExamResult;
use App\Models\Notice;
use App\Models\Schedule;
use App\Models\ScheduleStudentRel;
use App\Models\ScheduleSubjectRel;
use App\Models\Student;
use App\Models\Subject;
use App\Models\Teacher;
use App\Models\User;
use Yajra\DataTables\Facades\DataTables;
class StudentController extends Controller
{
function returnToLogin()
{
return redirect()
->route('login')
->with('success', 'sorry but the session already timeout');
}
function errHandler($th)
{
$ERR_CANNOT_GET_EMAIL = 'Attempt to read property "email" on null';
if ($ERR_CANNOT_GET_EMAIL == $th->getMessage()) {
return $this->returnToLogin();
} else {
throw $th;
}
}
public function helloworld()
{
return view('helloworld');
}
public function checkAnyNull($itemsToCheck)
{
$result = false;
foreach ($itemsToCheck as $itemToCheck) {
$result = $result || is_null($itemToCheck);
}
return $result;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
try {
Session::forget('status');
return view('students.index', compact('request'));
} catch (\Exception $e) {
dd($e);
return 'list student failed';
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
try {
return view('students.create', compact('request'));
} catch (\Exception $e) {
return 'add new student failed';
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'firstName' => 'required',
'lastName' => 'required',
'dateOfBirth' => 'required',
'gender' => '',
'email' => 'required',
'address' => 'required',
'password' => 'required',
]);
DB::beginTransaction();
$user = new User();
$user->name = join(', ', [
$validatedData['firstName'],
$validatedData['lastName'],
]);
$user->email = $validatedData['email'];
$user->password = $validatedData['password'];
$user->role = 'student';
$user->save();
// NOTE: save user to get user_id, referenced by student
$new_user_id = $user->id;
$student = new Student();
$student->firstName = $validatedData['firstName'];
$student->lastName = $validatedData['lastName'];
$student->dateOfBirth = $validatedData['dateOfBirth'];
if (isset($validatedData['gender'])) {
$student->gender = $validatedData['gender'];
}
$student->email = $validatedData['email'];
$student->address = $validatedData['address'];
$student->user_id = $new_user_id;
if ($request->avatarAction == 'NO_CHANGE') {
$student->avatar = null;
} elseif ($request->avatarAction == 'CLEAR') {
// NOTE: user intent clear avatar
$student->avatar = null;
} elseif ($request->avatarAction == 'UPDATE_AVATAR') {
// NOTE: user intent change avatar
$avatarFileName =
str_replace('@', '_', str_replace('.', '_', $student->email)) .
'.' .
$request->avatar->getClientOriginalExtension();
$request->avatar->move(public_path('avatars'), $avatarFileName);
$student->avatar = $avatarFileName;
}
$student->save();
DB::commit();
Session::forget('status');
return redirect()
->route('students.index')
->with('success', 'Student has been created successfully.');
} catch (\Exception $e) {
DB::rollback();
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('students.create', compact('request'));
// return 'save student failed';
}
}
/**
* Display the specified resource.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function show(Student $student, Request $request)
{
try {
$student_id = $student->id;
$student = Student::with(['schedules'])
->where('id', '=', $student->id)
->get()[0];
return view('students.show', compact('student', 'request'));
} catch (\Exception $e) {
dd($e);
return 'show student failed';
}
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function edit(Student $student, Request $request)
{
try {
$student_id = $student->id;
$schedules = Schedule::select()->get();
$student_selected_subject_records = Schedule::with(['students'])
->whereRelation('students', 'students.id', '=', $student_id)
->get();
$student_selected_subject_id = [];
foreach ($student_selected_subject_records as $student_selected_subject_record) {
array_push(
$student_selected_subject_id,
$student_selected_subject_record->id
);
}
// dd($student_selected_subject_id);
return view(
'students.edit',
compact(
'request',
'student',
'schedules',
'student_selected_subject_id'
)
);
} catch (\Exception $e) {
// dd($e);
return 'edit student failed';
}
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Student $student)
{
try {
$pattern = '/schedules_schedule_id_(\d+)/i';
$request_all = $request->all();
$validatedData = $request->validate([
'firstName' => 'required',
'lastName' => 'required',
'dateOfBirth' => 'required',
'gender' => '',
'email' => 'required',
'address' => 'required',
]);
DB::beginTransaction();
$student = Student::find($student->id);
$user_id = $student->user_id;
$user = User::find($user_id);
$student->firstName = $validatedData['firstName'];
$student->lastName = $validatedData['lastName'];
$student->dateOfBirth = $validatedData['dateOfBirth'];
if (isset($validatedData['gender'])) {
$student->gender = $validatedData['gender'];
}
$student->email = $validatedData['email'];
$student->address = $validatedData['address'];
$user->name = join(', ', [
$validatedData['firstName'],
$validatedData['lastName'],
]);
if ($request['password']) {
$user->password = $request['password'];
}
if ($request->avatarAction == 'NO_CHANGE') {
} elseif ($request->avatarAction == 'CLEAR') {
// NOTE: user intent clear avatar
$student->avatar = null;
} elseif ($request->avatarAction == 'UPDATE_AVATAR') {
// NOTE: user intent change avatar
$avatarFileName =
str_replace('@', '_', str_replace('.', '_', $student->email)) .
'.' .
$request->avatar->getClientOriginalExtension();
$request->avatar->move(public_path('avatars'), $avatarFileName);
$student->avatar = $avatarFileName;
}
// NOTE: update student applied subject
$applied_subjects = $student->schedules;
foreach ($applied_subjects as $key) {
$student->schedules()->detach($key->id);
}
foreach ($request_all as $key => $value) {
if (preg_match($pattern, $key, $m) == 1) {
if ($value == 'on') {
$schedule = Schedule::find($m[1]);
if (is_null($schedule)) {
} else {
$student->schedules()->attach($schedule->id);
}
}
}
}
$student->save();
$user->save();
DB::commit();
Session::forget('status');
return redirect()
->route('students.index')
->with('success', 'Student Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
$schedules = Schedule::select()->get();
return view('students.edit', compact('student', 'request', 'schedules'));
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function destroy(Student $student)
{
try {
DB::beginTransaction();
$student_id = $student->id;
$student = Student::find($student_id);
$user_id = $student->user_id;
$user = User::find($user_id);
$student->delete();
if ($user) {
$user->delete();
}
DB::commit();
return redirect()
->route('students.index')
->with('success', 'Student has been deleted successfully');
} catch (\Exception $e) {
DB::rollback();
// dd($e);
return 'delete student failed';
}
}
/**
* Display a listing of the students in json format
*
* @return \Illuminate\Http\Response
*/
public function getStudentsJson(Request $request)
{
try {
$arr = [];
if (is_null($request->query('q'))) {
// NOTE: return all records
$students = Student::all();
} else {
// NOTE: request with query word
$q_word = $request->query('q');
$students = Student::where('email', 'LIKE', '%' . $q_word . '%')->get();
}
foreach ($students as $row) {
array_push($arr, [
'id' => $row->id,
'name' => $row->name,
'studentId' => $row->studentId,
'firstName' => $row->firstName,
'lastName' => $row->lastName,
'dateOfBirth' => $row->dateOfBirth,
'gender' => $row->gender,
'email' => $row->email,
'address' => $row->address,
'classRoom' => $row->classRoom,
'parent' => $row->parent,
]);
}
return response()->json($arr);
} catch (\Exception $e) {
// dd($e);
return 'getStudentsJson failed';
}
}
public function getNumOfStudents()
{
try {
$student_count = Student::count();
return response()->json(['count' => "$student_count"]);
} catch (\Exception $e) {
// dd($e);
return 'getNumOfStudents failed';
}
}
public function setNoticeRead(Request $request, string $notice_id)
{
try {
$notice = Notice::find($notice_id);
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
$current_student->noticesRead()->attach($notice->id);
return view(
'students.showNotices',
compact('request', 'current_student')
);
} catch (\Exception $e) {
//throw $th;
dd($e);
}
}
public function showNotice(Request $request, string $notice_id)
{
try {
$notice = Notice::find($notice_id);
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
$current_student->noticesRead()->attach($notice->id);
return view(
'students.showNotice',
compact('request', 'current_student', 'notice')
);
} catch (\Exception $e) {
return redirect()->route('login');
}
}
public function dtGetStudents()
{
try {
//code...
$students = Student::select([
'id',
'firstName',
'lastName',
'gender',
'email',
]);
return DataTables::eloquent($students)->toJson();
} catch (\Exception $e) {
dd($e);
//throw $th;
}
}
public function showInfo(Student $student, Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
return view('students.showInfo', compact('request', 'current_student'));
} catch (\Exception $e) {
return $this->errHandler($e);
}
}
public function updateInfo(Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
$student_id = $current_student->id;
$validatedData = $request->validate([
'firstName' => 'required',
'lastName' => 'required',
'dateOfBirth' => 'required',
'gender' => 'required',
'email' => 'required',
'address' => 'required',
]);
DB::beginTransaction();
$student = Student::find($student_id);
$user_id = $student->user_id;
$user = User::find($user_id);
$student->firstName = $validatedData['firstName'];
$student->lastName = $validatedData['lastName'];
$student->dateOfBirth = $validatedData['dateOfBirth'];
$student->gender = $validatedData['gender'];
$student->email = $validatedData['email'];
$student->address = $validatedData['address'];
$user->name = join(', ', [
$validatedData['firstName'],
$validatedData['lastName'],
]);
if ($request['password']) {
$user->password = $request['password'];
}
if ($request->avatarAction == 'NO_CHANGE') {
// $student->avatar = NULL;
} elseif ($request->avatarAction == 'CLEAR') {
// NOTE: user intent clear avatar
$student->avatar = null;
} elseif ($request->avatarAction == 'UPDATE_AVATAR') {
// NOTE: user intent change avatar
$avatarFileName =
str_replace('@', '_', str_replace('.', '_', $student->email)) .
'.' .
$request->avatar->getClientOriginalExtension();
$request->avatar->move(public_path('avatars'), $avatarFileName);
$student->avatar = $avatarFileName;
}
// $student->fill($request->post())->save();
$student->save();
$user->save();
DB::commit();
Session::forget('status');
return redirect()
->route('studentInfo')
->with('success', 'Student information has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('students.showInfo', compact('student', 'request'));
}
}
public function showDashboard(Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
$num_of_subject_applied = Subject::count();
$num_of_exam = Exam::with(['students'])
->whereRelation('students', 'students.id', '=', $current_student->id)
->count();
$num_of_teacher = Teacher::count();
$num_of_student = Student::count();
$num_of_schedule = Schedule::with(['students'])
->whereRelation('students', 'students.id', '=', $current_student->id)
->count();
Session::forget('status');
return view(
'students.showDashboard',
compact(
'request',
'num_of_subject_applied',
'num_of_exam',
'num_of_schedule',
'num_of_teacher',
'num_of_student',
'current_student'
)
);
} catch (\Exception $e) {
return redirect()->route('login');
}
}
public function showNotifications(Request $request)
{
Session::forget('status');
return view('students.work_in_progress');
try {
// return view('students.show.notifications.index', compact('request'));
} catch (\Exception $e) {
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('student_dashboard', compact('student', 'request'));
}
}
public function showSchedules(Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::with(['schedules'])
->where('email', $email_to_find)
->get()[0];
$schedules = $current_student->schedules;
Session::forget('status');
return view(
'students.showSchedules',
compact('request', 'schedules', 'current_student')
);
} catch (\Exception $e) {
// dd($e);
DB::rollback();
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('student_dashboard', compact('student', 'request'));
}
}
public function showSubjects(Request $request)
{
try {
$email_to_find = $request->user()->email;
$subjects = Subject::select(['id', 'subjectTitle'])
->where('deleted', '=', 'false')
->get();
$schedules = Schedule::with(['subjects'])->get();
$current_student = Student::with(['schedules'])
->where('email', $email_to_find)
->get()[0];
$current_student_id = $current_student->id;
// $student_selected_subject_records = Schedule::with(['students' => function($q){
// $q->where('students.id', '=', 2);
// }])->get();
$student_selected_subject_records = Schedule::whereRelation(
'students',
'students.id',
'=',
$current_student_id
)->get();
$student_selected_subject_id = [];
foreach ($student_selected_subject_records as $student_selected_subject_record) {
array_push(
$student_selected_subject_id,
$student_selected_subject_record->id
);
}
Session::forget('status');
// students/show/subjects/index.blade.php
return view(
'students.showSubjects',
compact(
'request',
'subjects',
'current_student',
'schedules',
'student_selected_subject_id'
)
);
} catch (\Exception $e) {
DB::rollback();
return $this->errHandler($e);
// // dd($e);
// $message = $th->getMessage();
// $request->session()->put('status', $message);
// return 'studentShowSubjects failed';
}
}
public function updateSubject(Request $request)
{
// when student apply subject
try {
$pattern = '/schedules_schedule_id_(\d+)/i';
$request_all = $request->all();
$email_to_find = $request->user()->email;
$student = Student::where('email', '=', $email_to_find)->get()[0];
$student_id = $student->id;
$student = Student::find($student_id);
// NOTE: clear all applied subject
// TODO: simplify to: $student->schedules()->detach();
$applied_subjects = $student->schedules;
foreach ($applied_subjects as $key) {
$student->schedules()->detach($key->id);
}
foreach ($request_all as $key => $value) {
if (preg_match($pattern, $key, $m) == 1) {
if ($value == 'on') {
$schedule = Schedule::find($m[1]);
if (is_null($schedule)) {
} else {
$student->schedules()->attach($schedule->id);
}
}
}
}
Session::forget('status');
// return redirect()
// ->route('studentShowDashboard')
// ->with('success', 'update subject selection done');
return redirect()
->route('studentShowSubjects')
->with('success', 'Subjects application success !');
} catch (\Exception $e) {
DB::rollback();
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('student_dashboard', compact('student', 'request'));
}
}
public function clearAvatar(Request $request)
{
try {
$request_all = $request->all();
// $email_to_find = $request->user()->email;
$email_to_find = 'student1@school.com';
$student = Student::where('email', '=', $email_to_find)->get()[0];
$student_id = $student->id;
$student = Student::find($student_id);
$avatar_file = $student->avatar;
File::delete(public_path('avatars') . '/' . $avatar_file);
$student->avatar = null;
$student->save();
return view('students.edit', compact('student', 'request'));
} catch (\Exception $e) {
throw $e;
}
}
public function showNotices(Student $student, Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
return view(
'students.showNotices',
compact('request', 'current_student')
);
} catch (\Exception $e) {
return $this->errHandler($e);
}
}
public function showExamResults(Request $request)
{
try {
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
$student_id = $current_student->id;
$exam_results = ExamResult::where('student_id', '=', $student_id)->get();
$teachers_from_db = Teacher::all();
$teachers = [];
foreach ($teachers_from_db as $teacher) {
$teachers[$teacher->id] = $teacher;
}
$exams = [];
$exams_from_db = Exam::all();
foreach ($exams_from_db as $exam) {
$exams[$exam->id] = $exam;
}
return view(
'students.showExamResults',
compact(
'request',
'current_student',
'exam_results',
'exams',
'teachers'
)
);
} catch (\Exception $e) {
throw $e;
return route('studentShowDashboard');
}
}
public function showExamResult(Request $request, string $exam_result_id)
{
try {
$exam_result = ExamResult::find($exam_result_id);
$email_to_find = $request->user()->email;
$current_student = Student::where('email', $email_to_find)->get()[0];
return view(
'students.showExamResult',
compact('request', 'current_student', 'exam_result')
);
} catch (\Exception $e) {
//throw $th;
dd($e);
}
}
public function dtGetStudentSimpleSchedules(
Request $request,
string $student_id
) {
$schedules = Schedule::with(['classrooms', 'subjects', 'students'])
->whereRelation('students', 'students.id', '=', $student_id)
->orderBy('id', 'desc')
->limit(10)
->get();
return response()->json($schedules);
}
public function dtGetStudentSimpleExams(Request $request, string $student_id)
{
$exams = Exam::with(['subject', 'students'])
->whereRelation('students', 'students.id', '=', $student_id)
->orderBy('id', 'desc')
->limit(10)
->get();
return response()->json($exams);
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers;
use App\Models\Student;
use Illuminate\Http\Request;
class StudentHelloworldController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$students = Student::orderBy('id', 'desc')->paginate(10);
return view('students_helloworld.index', compact('students'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('students_helloworld.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
Student::create($request->post());
return redirect()
->route('students_helloworld.index')
->with('success', 'Student has been created successfully.');
}
/**
* Display the specified resource.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function show(Student $Student)
{
return view('students_helloworld.show', compact('Student'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function edit(Student $Student)
{
return view('students_helloworld.edit', compact('Student'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Student $Student)
{
$request->validate([
'name' => 'required',
'email' => 'required',
'address' => 'required',
]);
$Student->fill($request->post())->save();
return redirect()
->route('students_helloworld.index')
->with('success', 'Student Has Been updated successfully');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Student $Student
* @return \Illuminate\Http\Response
*/
public function destroy(Student $Student)
{
$Student->delete();
return redirect()
->route('students_helloworld.index')
->with('success', 'Student has been deleted successfully');
}
}

View File

@@ -0,0 +1,239 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use App\Models\Subject;
use Yajra\DataTables\Facades\DataTables;
class SubjectController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
Session::forget('status');
try {
return view('subjects.index', compact('request'));
} catch (\Exception $e) {
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return 'list subject failed';
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
try {
return view('subjects.create', compact('request'));
} catch (\Exception $e) {
// dd($e);
return 'create subject failed';
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
try {
$validatedData = $request->validate([
'subjectTitle' => 'required',
'syllabusDetails' => '',
]);
$subject = new Subject();
$subject->subjectTitle = $validatedData['subjectTitle'];
$subject->syllabusDetails = $validatedData['syllabusDetails'];
$subject->save();
Session::forget('status');
return redirect()
->route('subjects.index')
->with('success', 'Subject has been created successfully.');
} catch (\Exception $e) {
// dd($e);
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('subjects.create', compact('request'));
}
}
/**
* Display the specified resource.
*
* @param \App\Subject $Subject
* @return \Illuminate\Http\Response
*/
public function show(Subject $subject, Request $request)
{
try {
return view('subjects.show', compact('subject', 'request'));
} catch (\Exception $e) {
// dd($e);
return 'show subject failed';
}
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Subject $Subject
* @return \Illuminate\Http\Response
*/
public function edit(Subject $subject, Request $request)
{
try {
return view('subjects.edit', compact('request', 'subject'));
} catch (\Exception $e) {
dd($e);
return 'edit subject failed';
}
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Subject $Subject
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Subject $subject)
{
try {
$validatedData = $request->validate([
'subjectTitle' => 'required',
'syllabusDetails' => 'required',
]);
Subject::where('id', $subject->id)->update([
'subjectTitle' => $validatedData['subjectTitle'],
'syllabusDetails' => $validatedData['syllabusDetails'],
]);
return redirect()
->route('subjects.index')
->with('success', 'Subject Has Been updated successfully');
} catch (\Exception $e) {
DB::rollback();
$message = $e->getMessage();
$request->session()->put('status', $message);
return view('subjects.edit', compact('subject', 'request'));
}
}
/**
* Remove the specified resource from storage.
*
* @param \App\Subject $Subject
* @return \Illuminate\Http\Response
*/
public function destroy(Subject $subject)
{
try {
$subject->delete();
return redirect()
->route('subjects.index')
->with('success', 'Subject has been deleted successfully');
} catch (\Exception $e) {
dd($e);
return 'delete subject failed';
}
}
public function getSubjectsJson(Request $request)
{
try {
$arr = [];
if (is_null($request->query('q'))) {
// NOTE: return all records
$subjects = subject::orderBy('id', 'asc')->get();
foreach ($subjects as $row) {
array_push($arr, [
'id' => $row->id,
'subjectTitle' => $row->subjectTitle,
'syllabusDetails' => $row->syllabusDetails,
]);
}
} else {
// NOTE: request with query word
$q_word = $request->query('q');
$subjects = subject::where(
'subjectTitle',
'LIKE',
'%' . $q_word . '%'
)->get();
foreach ($subjects as $row) {
array_push($arr, [
'id' => $row->id,
'subjectTitle' => $row->subjectTitle,
'syllabusDetails' => $row->syllabusDetails,
]);
}
}
return response()->json($arr);
} catch (\Exception $e) {
// dd($e);
return 'getSubjectsJson failed';
}
}
public function dtGetSubjects()
{
$subjects = Subject::select(['id', 'subjectTitle'])->where(
'deleted',
'=',
'false'
);
return DataTables::eloquent($subjects)->toJson();
}
public function SoftDelete(Request $request, string $id)
{
// to prevent the delete alter the schedules assigned
try {
Subject::where('id', $id)->update([
'deleted' => 'true',
]);
return redirect()
->route('subjects.index')
->with('success', 'subject Has Been updated successfully');
} catch (\Exception $e) {
return redirect()
->route('subjects.index')
->with('failed', 'failed during delete subjects');
}
}
}

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 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,
'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,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class Cors
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
return $next($request);
}
}

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,33 @@
<?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,15 @@
<?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,18 @@
<?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,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use HasFactory;
protected $fillable = [
'name',
'id',
'firstName',
'lastName',
'dateOfBirth',
'gender',
'email',
'contact',
'skills',
];
// public function schedules()
// {
// return $this->belongsToMany(
// 'App\Models\Schedule',
// 'schedule_teacher_rel',
// 'teacher_id',
// 'schedule_id');
// }
// public function exams()
// {
// return $this->belongsToMany(
// 'App\Models\Exam',
// 'exam_teacher_rel',
// 'teacher_id',
// 'exam_id');
// }
// public function exam_results()
// {
// return $this->belongsToMany(
// 'App\Models\ExamResult',
// 'exam_result_teacher_rel',
// 'teacher_id',
// 'exam_result_id');
// }
// public function attendances()
// {
// return $this->belongsToMany(
// 'App\Models\Attendance',
// 'attendance_teacher_rel',
// 'teacher_id',
// 'attendance_id');
// }
public function notices()
{
return $this->belongsToMany(
'App\Models\Notice',
'notice_admin_rel',
'admin_id',
'notice_id'
);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Apple extends Model
{
use HasFactory;
protected $fillable = ['name', 'email', 'address'];
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Attendance extends Model
{
use HasFactory;
protected $table = 'attendance';
protected $fillable = [
'check_time',
'student_email',
'subject_id',
'remarks',
];
public function teachers()
{
return $this->belongsToMany(
'App\Models\Attendance',
'attendance_teacher_rel',
'attendance_id', // foreign key name of the model on which you are defining the relationship
'teacher_id'
); // foreign key name of the model that you are joining to
}
public function student()
{
return $this->belongsTo('App\Models\Student');
}
public function subject()
{
return $this->belongsTo('App\Models\Subject');
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ClassRoom extends Model
{
use HasFactory;
protected $fillable = [
'classRoomId',
'classRoomTitle',
'location',
'capacity',
];
public function schedules()
{
return $this->belongsToMany('App\Models\Schedule', 'class_room_activities');
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models;
use DateTime;
use DateInterval;
use DatePeriod;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class ClassRoomActivity extends Model
{
use HasFactory;
protected $fillable = ['date_epoch', 'classroomId', 'scheduleId'];
public function createClassRoomActivity(array $data)
{
return DB::transaction(function () use ($data) {
// NOTE: obsoleted
// $classRoomId = $data['classRoomId'];
// $scheduleId = $data['scheduleId'];
// $startTime = $data['startTime'];
// $endTime = $data['endTime'];
// $begin = new DateTime($startTime);
// $end = new DateTime($endTime);
// $interval = DateInterval::createFromDateString('1 day');
// $period = new DatePeriod($begin, $interval, $end);
// $arr = [];
// foreach ($period as $dt) {
// array_push($arr, $dt->format("Y-m-d"));
// }
// array_push($arr, $end->format("Y-m-d"));
// foreach ($arr as $day) {
// $class_room_activity = self::create([
// // strtotime('01-01-2023')
// 'date_epoch' => '88888',
// 'classroomId' => $classRoomId,
// 'scheduleId' => $scheduleId,
// ]);
// }
// return $class_room_activity;
return true;
});
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
use HasFactory;
protected $fillable = ['name', 'email', 'address'];
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Exam extends Model
{
use HasFactory;
protected $table = 'exams';
protected $fillable = ['date', 'subject_id', 'title', 'remarks'];
public function teachers()
{
return $this->belongsToMany(
'App\Models\Teacher',
'exam_teacher_rel',
'exam_id',
'teacher_id'
);
}
public function students()
{
return $this->belongsToMany(
'App\Models\Student',
'exam_student_rel',
'exam_id',
'student_id'
);
}
public function exam_results()
{
return $this->belongsToMany(
'App\Models\ExamResult',
'exam_exam_result_rel',
'exam_id',
'exam_result_id'
);
}
public function subject()
{
return $this->belongsTo('App\Models\Subject');
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ExamResult extends Model
{
use HasFactory;
protected $table = 'exam_results';
protected $fillable = [
'result',
'remarks',
'student_id',
'teacher_id',
'exam_id',
];
public function exams()
{
return $this->belongsToMany(
'App\Models\Exam',
'exam_exam_result_rel',
'exam_id',
'exam_result_id'
);
}
public function student()
{
return $this->belongsTo('App\Models\Student');
}
public function teacher()
{
return $this->belongsTo('App\Models\Teacher');
}
public function exam()
{
return $this->belongsTo('App\Models\Exam');
}
}

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 = 'helloworlds';
protected $fillable = ['name'];
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Notice extends Model
{
use HasFactory;
protected $table = 'notices';
protected $fillable = ['date', 'subject', 'content', 'from', 'to'];
public function students()
{
return $this->belongsToMany(
'App\Models\Student',
'notice_student_rel',
'notice_id',
'student_id'
);
}
public function teachers()
{
return $this->belongsToMany(
'App\Models\Teacher',
'notice_teacher_rel',
'notice_id',
'teacher_id'
);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
use HasFactory;
protected $table = 'payments';
protected $fillable = ['date', 'from', 'subject', 'amount', 'remarks'];
public function student()
{
return $this->belongsTo('App\Models\Student');
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use DateTime;
use DateInterval;
use DatePeriod;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class PresentScheduleRel extends Model
{
use HasFactory;
protected $table = 'present_schedule_rel';
protected $fillable = ['student_id', 'schedule_id'];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = ['name'];
public function users()
{
return $this->belongsToMany('App\Models\User', 'user_role_rel');
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Schedule extends Model
{
use HasFactory;
protected $fillable = ['subject', 'startTime', 'endTime', 'description'];
public function teachers()
{
return $this->belongsToMany('App\Models\Teacher', 'schedule_teacher_rel');
}
public function students()
{
return $this->belongsToMany('App\Models\Student', 'schedule_student_rel');
}
public function subjects()
{
return $this->belongsToMany('App\Models\Subject', 'schedule_subject_rel');
}
public function classrooms()
{
return $this->belongsToMany(
'App\Models\ClassRoom',
'class_room_activities'
)->withPivot(['id', 'date_epoch']);
}
public function presentStudent()
{
return $this->belongsToMany(
'App\Models\Student',
'present_schedule_rel',
'schedule_id',
'student_id'
);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use DateTime;
use DateInterval;
use DatePeriod;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class ScheduleStudentRel extends Model
{
use HasFactory;
protected $table = 'schedule_student_rel';
protected $fillable = ['student_id', 'schedule_id'];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use DateTime;
use DateInterval;
use DatePeriod;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class ScheduleSubjectRel extends Model
{
use HasFactory;
protected $table = 'schedule_subject_rel';
protected $fillable = ['subject_id', 'schedule_id'];
}

View File

@@ -0,0 +1,87 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Student extends Model
{
use HasFactory;
protected $fillable = [
'studentId',
'firstName',
'lastName',
'dateOfBirth',
'gender',
'email',
'address',
];
public function schedules()
{
return $this->belongsToMany(
'App\Models\Schedule',
'schedule_student_rel',
'student_id', // foreign key name of the model on which you are defining the relationship
'schedule_id'
); // foreign key name of the model that you are joining to
}
public function noticesRead()
{
return $this->belongsToMany(
'App\Models\Notice',
'notice_student_rel',
'student_id', // foreign key name of the model on which you are defining the relationship
'notice_id'
); // foreign key name of the model that you are joining to
}
public function notices()
{
return $this->belongsToMany(
'App\Models\Notice',
'notice_student_rel',
'student_id', // foreign key name of the model on which you are defining the relationship
'notice_id'
); // foreign key name of the model that you are joining to
}
public function presentSchedule()
{
// action to preform when student attend a schedule
return $this->belongsToMany(
'App\Models\Schedule',
'present_schedule_rel',
'student_id', // foreign key name of the model on which you are defining the relationship
'schedule_id'
); // foreign key name of the model that you are joining to
}
public function exams()
{
return $this->belongsToMany(
'App\Models\Exam',
'exam_student_rel',
'student_id',
'exam_id'
);
}
// public function exam_results()
// {
// return $this->belongsToMany(
// 'App\Models\ExamResult',
// 'exam_exam_result_rel',
// 'exam_result_id',
// 'student_id');
// }
public function exam_results()
{
return $this->hasMany('App\Models\ExamResult');
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use App\Models\Schedule;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Subject extends Model
{
use HasFactory;
protected $fillable = ['subjectId', 'subjectTitle', 'syllabusDetails'];
public function schedules()
{
return $this->belongsToMany(
'App\Models\Schedule',
'schedule_subject_rel',
'subject_id',
'schedule_id'
);
}
public function exams()
{
return $this->hasMany('App\Models\Exam');
}
public function exam_results()
{
return $this->hasMany('App\Models\ExamResult');
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Teacher extends Model
{
use HasFactory;
protected $fillable = [
'name',
'id',
'firstName',
'lastName',
'dateOfBirth',
'gender',
'email',
'contact',
'skills',
];
public function schedules()
{
return $this->belongsToMany(
'App\Models\Schedule',
'schedule_teacher_rel',
'teacher_id',
'schedule_id'
);
}
public function exams()
{
return $this->belongsToMany(
'App\Models\Exam',
'exam_teacher_rel',
'teacher_id',
'exam_id'
);
}
public function exam_results()
{
return $this->belongsToMany(
'App\Models\ExamResult',
'exam_result_teacher_rel',
'teacher_id',
'exam_result_id'
);
}
public function attendances()
{
return $this->belongsToMany(
'App\Models\Attendance',
'attendance_teacher_rel',
'teacher_id',
'attendance_id'
);
}
public function notices()
{
return $this->belongsToMany(
'App\Models\Notice',
'notice_teacher_rel',
'teacher_id',
'notice_id'
);
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Contracts\Auth\CanResetPassword;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use App\Notifications\ResetPasswordNotification;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name',
'email',
'password',
'location',
'phone',
'about',
'password_confirmation',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
public function roles()
{
return $this->belongsToMany('App\Models\Role', 'user_role_rel');
// ,'schedule_teacher_rel'
}
public function sendPasswordResetNotification($token)
{
try {
$this->notify(new ResetPasswordNotification($token));
} catch (\Exception $e) {
dd($e);
}
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ResetPasswordNotification extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct($token)
{
try {
$this->token = $token;
} catch (\Exception $e) {
dd('error during preparing password reset email');
}
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail($notifiable)
{
try {
return (new MailMessage())
->subject('Reset Password Notification')
->view('emails.password.reset', [
'url' => url('reset-password', $this->token),
]);
} catch (\Exception $e) {
dd($th);
}
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
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 = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* 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,36 @@
<?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,47 @@
<?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 the "home" route for your application.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/dashboard';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*/
protected function configureRateLimiting(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}

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,70 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"barryvdh/laravel-dompdf": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"laravel-frontend-presets/material-dashboard": "^2.0",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"yajra/laravel-datatables": "^10.0"
},
"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.0",
"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,219 @@
<?php
use Illuminate\Support\Facades\Facade;
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' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* 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,
// NOTE: https://github.com/barryvdh/laravel-dompdf
Barryvdh\DomPDF\ServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| 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([
// 'ExampleClass' => App\Example\ExampleClass::class,
// NOTE: https://github.com/barryvdh/laravel-dompdf
'PDF' => Barryvdh\DomPDF\Facade::class,
])
->toArray(),
];

View File

@@ -0,0 +1,113 @@
<?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,68 @@
<?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' => [
'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,106 @@
<?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'),
],
'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,32 @@
<?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,150 @@
<?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,281 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'public_path' => null, // Override the public path if needed
/*
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show and £.
*/
'convert_entities' => true,
'options' => [
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
'font_dir' => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
'font_cache' => storage_path('fonts'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PFDLib back end.
*/
'temp_dir' => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
'chroot' => realpath(base_path()),
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resouce may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
'allowed_protocols' => [
'file://' => ['rules' => []],
'http://' => ['rules' => []],
'https://' => ['rules' => []],
],
/**
* @var string
*/
'log_output_file' => null,
/**
* Whether to enable font subsetting or not.
*/
'enable_font_subsetting' => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
* Canvas_Factory} ultimately determines which rendering class to instantiate
* based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
'pdf_backend' => 'CPDF',
/**
* PDFlib license key
*
* If you are using a licensed, commercial version of PDFlib, specify
* your license key here. If you are using PDFlib-Lite or are evaluating
* the commercial version of PDFlib, comment out this setting.
*
* @link http://www.pdflib.com
*
* If pdflib present in web server and auto or selected explicitely above,
* a real license code must exist!
*/
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
'default_media_type' => 'screen',
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
'default_paper_size' => 'a4',
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
'default_paper_orientation' => 'portrait',
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
* @var string
*/
'default_font' => 'serif',
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
'dpi' => 96,
/**
* Enable inline PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate
* inline PHP contained within <script type="text/php"> ... </script> tags.
*
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Set this option to false if you wish to process
* untrusted documents.
*
* @var bool
*/
'enable_php' => false,
/**
* Enable inline Javascript
*
* If this setting is set to true then DOMPDF will automatically insert
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
*
* @var bool
*/
'enable_javascript' => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
* This is required for part of test case www/test/image_variants.html through www/examples.php
*
* Attention!
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* @var bool
*/
'enable_remote' => true,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
'font_height_ratio' => 1.1,
/**
* Use the HTML5 Lib parser
*
* @deprecated This feature is now always on in dompdf 2.x
* @var bool
*/
'enable_html5_parser' => true,
],
];

View File

@@ -0,0 +1,72 @@
<?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,50 @@
<?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', 10),
],
/*
|--------------------------------------------------------------------------
| 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,
],
];

View File

@@ -0,0 +1,130 @@
<?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,117 @@
<?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"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'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',
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'postmark' => [
'transport' => 'postmark',
// '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'],
],
],
/*
|--------------------------------------------------------------------------
| 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,92 @@
<?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,
],
],
/*
|--------------------------------------------------------------------------
| 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',
],
];

View File

@@ -0,0 +1,71 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(
',',
env(
'SANCTUM_STATEFUL_DOMAINS',
sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
)
)
),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];

View File

@@ -0,0 +1,32 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

View File

@@ -0,0 +1,199 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

View File

@@ -0,0 +1,32 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [resource_path('views')],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

View File

@@ -0,0 +1 @@
*.sqlite*

View File

@@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class AdminFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'firstName' => '',
'lastName' => '',
'dateOfBirth' => '',
'gender' => '',
'email' => '',
'contact' => '',
'skills' => '',
];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class AttendanceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class ClassRoomActivityFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'date_epoch' => '',
'classroomId' => '',
'scheduleId' => '',
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class ClassRoomFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'deleted' => 'false',
];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class ExamFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class ExamResultFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'remarks' => '',
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class HelloworldFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class NoticeFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class PaymentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class RoleFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => '',
];
}
}

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