This commit is contained in:
louiscklaw
2025-02-01 02:08:48 +08:00
parent 3de8aea20a
commit db8bf18f7a
754 changed files with 137077 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@@ -0,0 +1,144 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
# End of https://www.toptal.com/developers/gitignore/api/node

View File

@@ -0,0 +1,6 @@
# Stop and remove all running containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# Remove all container images
docker rmi $(docker images -q)

View File

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

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex
rm -rf example-app
composer create-project laravel/laravel example-app
pushd example-app
php artisan serve --host 0.0.0.0

View File

@@ -0,0 +1,8 @@
pushd ..
Compress-Archive laravel-helloworld-tryout-simple delivery-new.zip
rm .\delivery.zip
mv .\delivery-new.zip .\delivery.zip
popd

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{
"name": "laravel-docker-helloworld",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gitUpdate": "git add . && git commit -m\"update laravel-material-dashboard-simple-tryout,\" && git push",
"watch-bs": "browser-sync start --proxy \"localhost:8009\" --files \"**/*.php\""
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.29.1"
}
}

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -ex
pushd ./example-app
# composer update
composer install
php artisan migrate:fresh --seed
php artisan serve --host 0.0.0.0
popd

View File

@@ -0,0 +1,4 @@
FROM composer
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Helper;
class Helpers {
public static function getunlimitedTestAttempt($attempt)
{
$html = "";
if($attempt == 1){
$html = "<label class='badge badge-success'>Yes</label>";
}else{
$html = "<lable class='badge badge-primary'>No</lable>";
}
return $html;
}
}
?>

View File

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

View File

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

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function index() {
if(Auth::check()){
return redirect(route('admin.dashboard'));
}
return view('admin.login');
}
/* Login Check Authenticate User */
public function login(Request $request){
$validator = Validator::make($request->all(), [
'email' => 'required|email|max:255',
'password' => 'required|min:8',
]);
if ($validator->fails()) {
return redirect('login')
->withErrors($validator, 'login')
->withInput();
}
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
$user = Auth::user();
if($user->email_verified_at && $user->email_verified_at ==null){
$this->logout($request);
redirect()->route('login')->with("error","Your are not verified user.");
}
if($user->role == 1){
return redirect()->route('admin.dashboard')->with("success","Welcome To ". env("APP_NAME"));
}else{
redirect()->route('login')->with("error","Your are not authorized user.");
}
}else{
return redirect()->back()->with("error","Invalid Email Or Password.");
}
}
/*Logout*/
public function logout(Request $request){
Auth::logout();
$request->session()->regenerateToken();
return redirect()->route('login');
}
}

View File

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

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Models\User;
use Illuminate\Support\Facades\Crypt;
use App\Models\ResetPassword;
use App\Jobs\SendEmailJob;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\URL;
class ResetPasswordController extends Controller {
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
public function forgotpassword() {
return view('admin.forgotpassword');
}
public function sendEmailForgotPassword(Request $request) {
$validator = Validator::make($request->all(), [
'email' => 'required|email|max:255',
]);
if ($validator->fails()) {
return redirect('forgotpassword')
->withErrors($validator, 'forgotpassword')
->withInput();
}
$user = User::where('email', $request->email)->first();
if (!$user) {
return redirect()->route('forgotpassword')->with("error", "Your not Registered User.");
}
$token = Crypt::encrypt($request->email);
ResetPassword::updateOrCreate(["email" => $request->email, 'token' => $token]);
dispatch(new SendEmailJob([
'_blade' => 'forgot',
'name' => $user->name,
'toemail' => $request->email,
'token' => $token,
'url' => route('resetpassword', $token)
]));
return redirect()->route('forgotpassword')->with("success", "Your Forgot Password mail has been sent Succefully!");
}
public function resetpassword($token) {
$resetpasswordData = ResetPassword::where('token', $token)->first();
if (empty($resetpasswordData)) {
return redirect()->route('login')->with("error", "Your Reset Password link has been expired.");
}
return view('admin.resetpassword', compact('resetpasswordData'));
}
public function postResetPassword(Request $request) {
if ($request->password != $request->confirmpassword) {
return redirect()->route('resetpassword')->with("error", "Password and Confirm Password has been not match.");
}
$email = $request->email;
User::where('email', $email)->update(["password" => Hash::make($request->password)]);
ResetPassword::where('email', $email)->delete();
return redirect()->route('login')->with("success", "Your Password has been Reset Succefully!");
}
}

View File

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

View File

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

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Country;
use App\Models\State;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Validator;
class CountryController extends Controller
{
public function index()
{
return view('admin.country.index');
}
public function getCountryList(Request $request){
return Country::getCountryList($request);
}
public function create(Request $request){
return view('admin.country.create');
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|unique:country,name',
]);
if ($validator->fails()) {
return redirect()->route('admin.country.add')
->withErrors($validator, 'country')
->withInput();
}
$country = Country::addEditCountry($request);
if($country){
return redirect()->route('admin.country')->with("success","Country add Successfully!");
}else{
return redirect()->route('admin.add-country')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$country = Country::find($id);
return view('admin.country.edit',compact('country'));
}
public function update(Request $request,$id)
{
$validator = Validator::make($request->all(), [
'name' => 'required|unique:country,name,'.$id,
]);
if ($validator->fails()) {
return redirect()->route('admin.country.edit',$id)
->withErrors($validator, 'country')
->withInput();
}
$country = Country::addEditCountry($request,$id);
if($country){
return redirect()->route('admin.country')->with("success","Country update Successfully!");
}else{
return redirect()->route('admin.country.edit',$id)->with("error","Some thing went wrong!");
}
}
public function delete(Request $request)
{ $state = State::where('country_id',$request->id)->get();
if ($state->count() == 0){
$data = Country::countrydelete($request->id);
if($data == 1){
echo json_encode(["status"=>1]);exit;
}else{
echo json_encode(["status"=>0]);exit;
}
}else{
echo json_encode(["status"=>2]);exit;
}
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use App\Models\Exam;
use Illuminate\Http\Request;
use App\Models\ExamCategory;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Response;
class ExamCategoryController extends Controller
{
public function index(){
return view('admin.examcategory.index');
}
public function getExamCategoryList(Request $request){
return ExamCategory::getExamCategoryList($request);
}
public function create(Request $request){
return view('admin.examcategory.create');
}
function store(Request $request){
$validator = Validator::make($request->all(), [
'title' => 'required|unique:exam_category,title'
]);
if ($validator->fails()) {
return redirect()->route('admin.examcategory.add')
->withErrors($validator, 'examcategory')
->withInput();
}
$state = ExamCategory::addEditExamCategory($request);
if($state){
return redirect()->route('admin.examcategory')->with("success","Exam Category add Successfully!");
}else{
return redirect()->route('admin.examcategory.add')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$examcategory = ExamCategory::find($id);
return view('admin.examcategory.edit',compact('examcategory'));
}
public function update(Request $request,$id){
$validator = Validator::make($request->all(), [
'title' => 'required|unique:exam_category,title,except'.$id
]);
if ($validator->fails()) {
return redirect()->route('admin.examcategory.edit',$id)
->withErrors($validator, 'examcategory')
->withInput();
}
$country = ExamCategory::addEditExamCategory($request,$id);
if($country){
return redirect()->route('admin.examcategory')->with("success","Exam Category update Successfully!");
}else{
return redirect()->route('admin.examcategory.edit')->with("error","Some thing went wrong!");
}
}
public function delete(Request $request){
$exam = Exam::where('exam_category_id',$request->id)->get();
if ($exam->count() == 0){
$data = ExamCategory::ExamCategorydelete($request->id);
if($data == 1){
echo json_encode(["status"=>1]);exit;
}else{
echo json_encode(["status"=>0]);exit;
}
}else{
echo json_encode(["status"=>2]);exit;
}
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use App\Models\Country;
use Illuminate\Http\Request;
use App\Models\Exam;
use App\Models\ExamCategory;
use App\Models\Plan;
use App\Models\State;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Validator;
class ExamController extends Controller
{
public function index(){
return view('admin.exam.index');
}
public function getExamList(Request $request){
return Exam::getExamList($request);
}
public function get_StateList(Request $request)
{
$country = $request->country_id;
$state = State::get_StateList($country);
return Response::json($state);
}
public function create(Request $request){
$country = Country::get_CountryList();
$examCategory = ExamCategory::get_ExamCategoryList();
return view('admin.exam.create',compact('country','examCategory'));
}
function store(Request $request){
$validator = Validator::make($request->all(), [
'country' => 'required',
'state' => 'required',
'examcategory' => 'required',
'name' => 'required|unique:exam,name',
]);
if ($validator->fails()) {
return redirect()
->route('admin.exam.add')
->withErrors($validator, 'exam')
->withInput();
}
$Exam = Exam::addEditExam($request);
if ($Exam) {
return redirect()
->route('admin.exam')
->with('success', 'Exam update Successfully!');
} else {
return redirect()
->route('admin.exam.add')
->with('error', 'Some thing went wrong!');
}
}
public function edit($id){
$exam = Exam::find($id);
$country = Country::get_CountryList();
$state = State::all();
$examCategory = ExamCategory::get_ExamCategoryList();
return view('admin.exam.edit', compact('exam','country','state','examCategory'));
}
public function update(Request $request, $id){
$validator = Validator::make($request->all(), [
'name' => 'required|unique:exam,name,'. $id,
'country' => 'required',
'state' => 'required',
'examcategory' => 'required',
]);
if ($validator->fails()) {
return redirect()
->route('admin.exam.edit', $id)
->withErrors($validator, 'exam')
->withInput();
}
$Exam = Exam::addEditExam($request, $id);
if ($Exam) {
return redirect()
->route('admin.exam')
->with('success', 'Exam update Successfully!');
} else {
return redirect()
->route('admin.Exam.edit', $id)
->with('error', 'Some thing went wrong!');
}
}
public function delete(Request $request){
$plan = Plan::where('exam_id',$request->id)->get();
if ($plan->count() == 0){
$data = Exam::Examdelete($request->id);
if($data == 1){
echo json_encode(["status"=>1],true);exit;
}else{
echo json_encode(["status"=>0],true);exit;
}
}else{
echo json_encode(["status"=>2],true);exit;
}
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use App\Services\CommonService;
class HomeController extends Controller {
protected $service;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct(CommonService $userService) {
$this->middleware('auth');
$this->service = $userService;
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function dashboard() {
if (Auth::user()) {
$data['totalExam'] = $this->service->totalExam();
$data['totalPlan'] = $this->service->totalPlan();
$data['totalSubject'] = $this->service->totalSubject();
$data['totalTest'] = $this->service->totalTest();
$data['totalCountry'] = $this->service->totalCountry();
$data['totalState'] = $this->service->totalState();
return view('admin.dashboard', compact('data'));
} else {
Auth::logout();
return redirect(route('login'));
}
}
/*
* Admin Profile
*/
public function profile() {
$user = User::find(Auth::user()->id);
return view('admin.profile', compact('user'));
}
/*
* Update User Profile
*/
public function updateProfile(Request $request) {
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
]);
if ($validator->fails()) {
return redirect('admin/profile')->withErrors($validator, 'profile')->withInput();
}
User::updateProfile($request, Auth::user()->id);
return redirect()->route('admin.profile')->with('success', 'Profile Update Successfully!');
}
/*
* Update User Password
*/
public function updatePassword(Request $request) {
$validator = Validator::make($request->all(), [
'currentpassword' => 'required|max:255',
'newpassword' => 'required|max:255',
'password_confirmation' => 'required|max:255|same:newpassword',
]);
if ($validator->fails()) {
return redirect('admin/profile')->withErrors($validator, 'changepassword')->withInput();
}
if (!Hash::check($request->currentpassword, Auth::user()->password)) {
return redirect()->route('admin.profile')->with('error', 'Password and Current Password does not match.');
}
if ($request->newpassword != $request->password_confirmation) {
return redirect()->route('admin.profile')->with('error', 'New Password and Confirm Password does not match.');
}
User::updatePassword($request, Auth::user()->id);
return redirect()->route('admin.profile')->with('success', 'Password Change Successfully!');
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace App\Http\Controllers;
use App\Models\Exam;
use Illuminate\Http\Request;
use App\Models\Plan;
use Illuminate\Support\Facades\Validator;
class PlanController extends Controller
{
public function index(){
return view('admin.plan.index');
}
public function getPlanList(Request $request){
return Plan::getPlanList($request);
}
public function create(Request $request){
$exam = Exam::all();
return view('admin.plan.create',compact('exam'));
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'exam' => 'required',
'name' => 'required|unique:plans,name',
'year' => 'required|numeric',
'price' => 'required',
'validity' => 'required',
'unlimited_test_attempt'=>"required",
'attempt' => 'required_if:unlimited_test_attempt,==,0',
]);
$message = array(
'required_if' =>'Attempt field is required.'
);
if ($validator->fails($message)) {
return redirect()->route('admin.plan.add')
->withErrors($validator, 'plan')
->withInput();
}
$plan = Plan::addEditPlan($request);
if($plan){
return redirect()->route('admin.plan')->with("success","Plan add Successfully!");
}else{
return redirect()->route('admin.add-plan')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$exam = Exam::all();
$plan = Plan::find($id);
return view('admin.plan.edit',compact('plan','exam'));
}
public function update(Request $request,$id)
{
$validator = Validator::make($request->all(), [
'exam' => 'required',
'name' => 'required|unique:plans,name,'.$id,
'year' => 'required|numeric',
'price' => 'required',
'validity' => 'required',
'unlimited_test_attempt'=>"required",
'attempt' => 'required_if:unlimited_test_attempt,==,0',
]);
if ($validator->fails()) {
return redirect()->route('admin.plan.edit',$id)
->withErrors($validator, 'plan')
->withInput();
}
$plan = Plan::addEditPlan($request,$id);
if($plan){
return redirect()->route('admin.plan')->with("success","Plan update Successfully!");
}else{
return redirect()->route('admin.plan.edit',$id)->with("error","Some thing went wrong!");
}
}
public function delete(Request $request)
{ $exam = Plan::where('id',$request->id)->get();
if(empty($state)){
$data = Plan::countrydelete($request->id);
if($data == 1){
echo json_encode(["status"=>1]);exit;
}else{
echo json_encode(["status"=>2]);exit;
}
}else{
echo json_encode(["status"=>0]);exit;
}
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\State;
use App\Models\Country;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Response;
class StateController extends Controller
{
public function index(){
return view('admin.state.index');
}
public function getStateList(Request $request){
return State::getStateList($request);
}
public function create(Request $request){
$country = Country::get_CountryList();
return view('admin.state.create',compact('country'));
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'country' =>'required',
'name' => 'required|unique:state,name',
]);
if ($validator->fails()) {
return redirect('admin/add-state')
->withErrors($validator, 'state')
->withInput();
}
$state = State::addEditState($request);
if($state){
return redirect()->route('admin.state')->with("success","State add Successfully!");
}else{
return redirect()->route('admin.add-state')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$country = Country::get_CountryList();
$state = State::find($id);
return view('admin.state.edit',compact('country','state'));
}
public function update(Request $request,$id)
{
$validator = Validator::make($request->all(), [
'country' =>'required',
'name' => 'required|unique:state,name,'.$id
]);
if ($validator->fails()) {
return redirect()->route('admin.state.edit',$id)
->withErrors($validator, 'state')
->withInput();
}
$state = State::addEditState($request,$id);
if($state){
return redirect()->route('admin.state')->with("success","State update Successfully!");
}else{
return redirect()->route('admin.state.edit',$id)->with("error","Some thing went wrong!");
}
}
public function delete(Request $request)
{
$data = State::Statedelete($request->id);
if($data == 1){
return Response::json(["status"=>true],200);
}else{
return Response::json(["status"=>false],500);
}
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Response;
use App\Models\Subject;
use App\Models\Plan;
use App\Models\Test;
class SubjectController extends Controller
{
public function index(){
return view('admin.subject.index');
}
public function getSubjectList(Request $request){
return Subject::getSubjectList($request);
}
public function create(Request $request){
$plan = Plan::get_PlanList();
return view('admin.subject.create',compact('plan'));
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'plan' =>'required',
'name' => 'required|unique:subjects,name',
]);
if ($validator->fails()) {
return redirect('admin/add-subject')
->withErrors($validator, 'state')
->withInput();
}
$state = Subject::addEditSubject($request);
if($state){
return redirect()->route('admin.subject')->with("success","State add Successfully!");
}else{
return redirect()->route('admin.add-subject')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$plan = Plan::get_PlanList();
$subject = Subject::find($id);
return view('admin.subject.edit',compact('plan','subject'));
}
public function update(Request $request,$id)
{
$validator = Validator::make($request->all(), [
'plan' =>'required',
'name' => 'required|unique:subjects,name,'.$id
]);
if ($validator->fails()) {
return redirect()->route('admin.subject.edit',$id)
->withErrors($validator, 'subject')
->withInput();
}
$subject = Subject::addEditSubject($request,$id);
if($subject){
return redirect()->route('admin.subject')->with("success","Subject update Successfully!");
}else{
return redirect()->route('admin.subject.edit',$id)->with("error","Some thing went wrong!");
}
}
public function delete(Request $request)
{
$test = Test::where('subject_id',$request->id)->get();
if ($test->count() == 0){
$data = Subject::Subjectdelete($request->id);
if($data == 1){
echo json_encode(["status"=>1]);exit;
}else{
echo json_encode(["status"=>0]);exit;
}
}else{
echo json_encode(["status"=>2]);exit;
}
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Test;
use App\Models\Subject;
use Illuminate\Support\Facades\Validator;
class TestController extends Controller
{
public function index()
{
return view('admin.test.index');
}
public function getTestList(Request $request)
{
return Test::getTestList($request);
}
public function create(Request $request)
{
$subject = Subject::all();
return view('admin.test.create',compact('subject'));
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'subject' => 'required',
'name' => 'required|unique:test,name',
]);
if ($validator->fails()) {
return redirect()->route('admin.test.add')
->withErrors($validator, 'test')
->withInput();
}
$test = Test::addEditTest($request);
if ($test) {
return redirect()->route('admin.test')->with("success", "Test add Successfully!");
} else {
return redirect()->route('admin.add-test')->with("error", "Some thing went wrong!");
}
}
public function edit($id)
{
$subject = Subject::all();
$test = Test::find($id);
return view('admin.test.edit', compact('subject','test'));
}
public function update(Request $request, $id)
{
$validator = Validator::make($request->all(), [
'subject' => 'required',
'name' => 'required|unique:test,name,' . $id,
]);
if ($validator->fails()) {
return redirect()->route('admin.test.edit', $id)
->withErrors($validator, 'test')
->withInput();
}
$test = Test::addEditTest($request, $id);
if ($test) {
return redirect()->route('admin.test')->with("success", "Test update Successfully!");
} else {
return redirect()->route('admin.test.edit', $id)->with("error", "Some thing went wrong!");
}
}
public function delete(Request $request)
{
$data = Test::testdelete($request->id);
if ($data == 1) {
echo json_encode(["status" => 1]);
exit;
} else {
echo json_encode(["status" => 0]);
exit;
}
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\TestQuestion;
use App\Models\Test;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Response;
class TestQuestionController extends Controller
{
public function index(){
return view('admin.test_question.index');
}
public function getQuestionList(Request $request){
return TestQuestion::getQuestionList($request);
}
public function create(Request $request){
$test = TestQuestion::get_TestList();
return view('admin.test_question.create',compact('test'));
}
function store(Request $request)
{
$validator = Validator::make($request->all(), [
'test' =>'required',
'question' => 'required|unique:test_question,question',
'option_1' => 'required|unique:test_question,option_1',
'option_2' => 'required|unique:test_question,option_2',
'option_3' => 'required|unique:test_question,option_2',
'option_4' => 'required|unique:test_question,option_2',
'true_answer' => 'required|unique:test_question,true_answer',
'solution' => 'required|unique:test_question,solution',
]);
if ($validator->fails()) {
return redirect('admin/add-question')
->withErrors($validator, 'testquestion')
->withInput();
}
$question = TestQuestion::addEditTestQuestion($request);
if($question){
return redirect()->route('admin.question')->with("success","Test Question add Successfully!");
}else{
return redirect()->route('admin.add-question')->with("error","Some thing went wrong!");
}
}
public function edit($id){
$test = TestQuestion::get_TestList();
$state = TestQuestion::find($id);
return view('admin.test_question.edit',compact('country','state'));
}
public function update(Request $request,$id)
{
$validator = Validator::make($request->all(), [
'test' =>'required',
'question' => 'required|unique:test_question,question',
'option_1' => 'required|unique:test_question,option_1',
'option_2' => 'required|unique:test_question,option_2',
'option_3' => 'required|unique:test_question,option_2',
'option_4' => 'required|unique:test_question,option_2',
'true_answer' => 'required|unique:test_question,true_answer',
'solution' => 'required|unique:test_question,solution',
]);
if ($validator->fails()) {
return redirect()->route('admin.state.edit',$id)
->withErrors($validator, 'state')
->withInput();
}
$question = TestQuestion::addEditTestQuestion($request,$id);
if($question){
return redirect()->route('admin.state')->with("success","Test Question update Successfully!");
}else{
return redirect()->route('admin.state.edit',$id)->with("error","Some thing went wrong!");
}
}
public function delete(Request $request)
{
$data = TestQuestion::Statedelete($request->id);
if($data == 1){
return Response::json(["status"=>true],200);
}else{
return Response::json(["status"=>false],500);
}
}
public function show($id){
$testquestion = TestQuestion::find($id);
return view('admin.test_question.show',compact('testquestion'));
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers\front;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
class AuthController extends Controller
{
/* Login / Register Page */
public function login()
{
return view('front.login');
}
/* Login */
public function postlogin(Request $request)
{
$validator = Validator::make($request->all(), [
'email' => 'required|email|max:255',
'password' => 'required|min:8',
]);
if ($validator->fails()) {
return redirect('front.login')
->withErrors($validator, 'login')
->withInput();
}
if (Auth::attempt($request->only('email', 'password'))) {
$user = Auth::user();
if ($user->role != config('const.studentRole')) {
return redirect()->route('front.login')->with("error", "You are not authorized user.");
}
return redirect()->route('front.dashboard');
} else {
return redirect()->route('front.login')->with("error", "Invalid Email Or Password.");
}
}
/* Regisert */
public function register(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:100',
'email' => 'required|unique:users,email|max:190',
'password' => 'required|confirmed',
'password_confirmation' => 'required|same:password'
]);
$message = array(
'password.confirmed' => 'Password and Confirm Password doesnot match.'
);
if ($validator->fails($message)) {
return redirect()->route('front.login')
->withErrors($validator, 'register')
->withInput();
}
$user = User::where('email', $request->email)->count();
if ($user > 0) {
return redirect()->route('front.login')->with("error", "Email is already registered.");
}
$user = User::register($request);
if ($user) {
return redirect()->route('front.login')->with("success", "You are Register Successfully!");
} else {
return redirect()->route('front.login')->with("error", "Some thing went wrong!");
}
}
/*Logout*/
public function logout(Request $request)
{
Auth::logout();
$request->session()->regenerateToken();
return redirect()->route('front.login');
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\front;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
class FrontHomeController extends Controller
{
public function index() {
return view('front.index');
}
/* Student Dashboard */
public function dashboard(){
return view('front.dahsboard');
}
/* Student Profile */
public function profile(){
return view('front.profile');
}
/* Student Change Password */
public function changepassword(){
return view('front.changepassword');
}
/*
* Update User Password
*/
public function updatePassword(Request $request) {
$validator = Validator::make($request->all(), [
'currentpassword' => 'required|max:255',
'password' => 'required|max:255',
'password_confirmation' => 'required|max:255|same:password',
]);
if ($validator->fails()) {
return redirect()->route('front.changepassword')->withErrors($validator, 'changepassword')->withInput();
}
if (!Hash::check($request->currentpassword, Auth::user()->password)) {
return redirect()->route('front.changepassword')->with('error', 'Password and Current Password does not match.');
}
if ($request->newpassword != $request->confirmpassword) {
return redirect()->route('front.changepassword')->with('error', 'New Password and Confirm Password does not match.');
}
User::updatePassword($request, Auth::user()->id);
return redirect()->route('front.changepassword')->with('success', 'Password Change Successfully!');
}
}

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,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'prevent-back-history' => \App\Http\Middleware\PreventBackHistory::class,
];
}

View File

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

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,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class PreventBackHistory {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next) {
$response = $next($request);
return $response->header('Cache-Control', 'nocache, no-store, max-age=0, must-revalidate')
->header('Pragma', 'no-cache')
->header('Expires', 'Sun, 02 Jan 1990 00:00:00 GMT');
}
}

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

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
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,54 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use App\Mail\Sendmail;
class SendEmailJob implements ShouldQueue {
use Dispatchable,
InteractsWithQueue,
Queueable,
SerializesModels;
protected $event;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($event) {
$this->event = $event;
}
/**
* Build the message.
*
* @return $this
*/
public function build() {
return $this->subject('Mail from ItSolutionStuff.com')->view('mail.forgot');
}
/**
* Execute the job.
*
* @return void
*/
public function handle() {
$event = $this->event;
Mail::send('mail.' . $this->event['_blade'], $event, function ($message) use ($event) {
$message->to($event['toemail'], env('APP_NAME'));
$message->subject('Forgot Password');
});
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class Sendmail extends Mailable {
use Queueable,
SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct() {
//
}
/**
* Get the message envelope.
*
* @return \Illuminate\Mail\Mailables\Envelope
*/
public function envelope() {
return new Envelope(
subject: 'Sendmail',
);
}
/**
* Get the message content definition.
*
* @return \Illuminate\Mail\Mailables\Content
*/
public function content() {
return new Content(
view: 'view.name',
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments() {
return [];
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use PHPUnit\Framework\Constraint\Count;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yajra\DataTables\Facades\DataTables;
use App\Models\State;
use Illuminate\Support\Facades\Response;
class Country extends Model
{
use HasFactory, SoftDeletes;
protected $table = "country";
public static function getCountryList($request)
{
if ($request->ajax()) {
$data = Country::orderBy('id','desc');
return DataTables::of($data)
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route("admin.country.edit", $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_counntry" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit Country */
public static function addEditCountry($request, $id = '')
{
if ($id) {
$data = Country::find($id);
} else {
$data = new Country();
}
$data->name = $request->name;
$data->save();
return $data;
}
/* Delete Country */
public static function countrydelete($id)
{
Country::where('id', $id)->delete();
return 1;
}
/* Get Country List */
public static function get_CountryList()
{
return Country::all();
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Country;
use App\Models\State;
use App\Models\ExamCategory;
class Exam extends Model {
use HasFactory,
SoftDeletes;
protected $table = 'exam';
public function getCountry() {
return $this->hasOne(Country::class, 'id', 'country_id');
}
public function getState() {
return $this->hasOne(State::class, 'id', 'state_id');
}
public function getExamCategory() {
return $this->hasOne(ExamCategory::class, 'id', 'exam_category_id');
}
public static function getExamList($request) {
if ($request->ajax()) {
$data = Exam::with(['getCountry', 'getState', 'getExamCategory']);
if ($request->order) {
$data->orderBy('id', 'desc');
}
return DataTables::of($data)
->addColumn('country', function ($row) {
return $row->getCountry->name;
})
->addColumn('state', function ($row) {
return $row->getState->name;
})
->addColumn('category', function ($row) {
return $row->getExamCategory->title;
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.exam.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_exam" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit Country */
public static function addEditExam($request, $id = '') {
if ($id) {
$data = Exam::find($id);
} else {
$data = new Exam();
}
$data->exam_category_id = $request->examcategory;
$data->country_id = $request->country;
$data->state_id = $request->state;
$data->name = $request->name;
$data->description = $request->description;
$data->save();
return $data;
}
/* Delete Exam */
public static function Examdelete($id) {
Exam::where('id', $id)->delete();
return 1;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Response;
use Yajra\DataTables\Facades\DataTables;
use App\Models\Exam;
class ExamCategory extends Model
{
use HasFactory, SoftDeletes;
protected $table = "exam_category";
public static function getExamCategoryList($request)
{
if ($request->ajax()) {
$data = ExamCategory::orderBy('id', 'desc');
return DataTables::of($data)
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.examcategory.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_examcategory" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit Country */
public static function addEditExamCategory($request, $id = '')
{
if ($id) {
$data = ExamCategory::find($id);
} else {
$data = new ExamCategory();
}
$data->title = $request->title;
$data->save();
return $data;
}
/* Delete Country */
public static function ExamCategorydelete($id)
{
ExamCategory::where('id', $id)->delete();
return 1;
}
/* Exam Category */
public static function get_ExamCategoryList()
{
return ExamCategory::all();
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Exam;
use Yajra\DataTables\Facades\DataTables;
use App\Helper\Helpers;
class Plan extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'plans';
public function getExam(){
return $this->hasOne(Exam::class,'id','exam_id');
}
public static function getPlanList($request)
{
if ($request->ajax()) {
$data = Plan::with(['getExam']);
if($request->order){
$data->orderBy('id','desc');
}
return DataTables::of($data)
->addColumn('exam', function ($row) {
return $row->getExam->name;
})
->addColumn('unlimited_test_attempt', function ($row) {
return Helpers::getunlimitedTestAttempt($row->unlimited_test_attempt);
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.plan.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_plan" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['unlimited_test_attempt','action'])
->make(true);
}
}
/* Add Edit Plan */
public static function addEditPlan($request, $id = '')
{
if ($id) {
$data = Plan::find($id);
} else {
$data = new Plan();
}
$data->exam_id = $request->exam;
$data->name = $request->name;
$data->year = $request->year;
$data->price = $request->price ;
$data->validity = $request->validity;
$data->unlimited_test_attempt = $request->unlimited_test_attempt;
$data->attempt = ($request->unlimited_test_attempt == 0) ? $request->attempt : null;
$data->description = $request->description;
$data->save();
return $data;
}
/* Delete Plan */
public static function Plandelete($id)
{
return Plan::where('id', $id)->delete();
}
/* Get Plan List */
public static function get_PlanList()
{
return Plan::all();
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ResetPassword extends Model {
use HasFactory;
protected $table = "password_resets";
protected $fillable = ['email', 'token'];
}

View File

@@ -0,0 +1,62 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use PHPUnit\Framework\Constraint\Count;
use Yajra\DataTables\Facades\DataTables;
class State extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'state';
public function getCountry()
{
return $this->hasOne(Country::class, 'id', 'country_id');
}
public static function getStateList($request)
{
if ($request->ajax()) {
$data = State::with('getCountry');
$data->orderBy('id','desc');
return DataTables::of($data)
->addColumn('country', function ($row) {
return $row->getCountry->name;
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.state.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_state" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit State */
public static function addEditState($request, $id = '')
{
if ($id) {
$data = State::find($id);
} else {
$data = new State();
}
$data->country_id = $request->country;
$data->name = $request->name;
$data->save();
return $data;
}
/* Delete State */
public static function Statedelete($id)
{
return State::where('id', $id)->delete();
}
/* Get State List */
public static function get_StateList($country='')
{
return State::where('country_id', $country)->get();
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Yajra\DataTables\Facades\DataTables;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Plan;
class Subject extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'subjects';
public function getPlan()
{
return $this->hasOne(Plan::class, 'id', 'plan_id');
}
public static function getSubjectList($request)
{
if ($request->ajax()) {
$data = Subject::with('getPlan');
$data->orderBy('id', 'desc');
return DataTables::of($data)
->addColumn('plan', function ($row) {
return $row->getPlan->name;
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.subject.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_subject" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit State */
public static function addEditSubject($request, $id = '')
{
if ($id) {
$data = Subject::find($id);
} else {
$data = new Subject();
}
$data->plan_id = $request->plan;
$data->name = $request->name;
$data->save();
return $data;
}
/* Delete State */
public static function Subjectdelete($id)
{
return Subject::where('id', $id)->delete();
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Subject;
use Yajra\DataTables\Facades\DataTables;
class Test extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'test';
public function getSubject()
{
return $this->hasOne(Subject::class, 'id', 'subject_id');
}
public static function getTestList($request)
{
if ($request->ajax()) {
$data = Test::with('getSubject');
if ($request->order) {
$data->orderBy('id', 'desc');
}
return DataTables::of($data)
->addColumn('subject', function ($row) {
return $row->getSubject->name;
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route("admin.test.edit", $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-flat btn-sm delete_test" data-id="' . $row->id . '" ><i class="fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit Test */
public static function addEditTest($request, $id = '')
{
if ($id) {
$data = Test::find($id);
} else {
$data = new Test();
}
$data->subject_id = $request->subject;
$data->name = $request->name;
$data->description = $request->description;
$data->save();
return $data;
}
/* Delete Country */
public static function testdelete($id)
{
Test::where('id', $id)->delete();
return 1;
}
/* Get Subject List */
public static function get_SubjectList()
{
return Subject::all();
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Test;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yajra\DataTables\Facades\DataTables;
class TestQuestion extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'test_question';
public function getTest()
{
return $this->hasOne(Test::class, 'id', 'test_id');
}
/* Get Question List*/
public static function getQuestionList($request)
{
if ($request->ajax()) {
$data = TestQuestion::with('getTest');
$data->orderBy('id','desc');
return DataTables::of($data)
->addColumn('test', function ($row) {
return $row->getTest->name;
})
->addColumn('action', function ($row) {
$actionBtn = '<a href="' . route('admin.question.show', $row->id) . '" class="edit btn btn-primary btn-flat btn-sm"><i class="fa fa-eye"></i> </a> <a href="' . route('admin.question.edit', $row->id) . '" class="edit btn btn-success btn-flat btn-sm"><i class="fa fa-pencil-square-o"></i> </a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm btn-flat delete_question" data-id="' . $row->id . '" ><i class=" fa-sharp fa-solid fa fa-trash"></i></a>';
return $actionBtn;
})
->rawColumns(['action'])
->make(true);
}
}
/* Add Edit Question */
public static function addEditTestQuestion($request, $id = ''){
if ($id) {
$data = TestQuestion::find($id);
} else {
$data = new TestQuestion();
}
$data->test_id = $request->test;
$data->question = $request->question;
$data->option_1 = $request->option_1;
$data->option_2 = $request->option_2;
$data->option_3 = $request->option_3;
$data->option_4 = $request->option_4;
$data->true_answer = $request->true_answer;
$data->solution = $request->solution;
$data->save();
return $data;
}
/* Delete State */
public static function Statedelete($id){
return TestQuestion::where('id', $id)->delete();
}
/* Get Test List */
public static function get_TestList(){
return Test::all();
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Illuminate\Support\Facades\Hash;
class User extends Authenticatable {
use HasApiTokens,
HasFactory,
Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public static function updateProfile($request, $id) {
$user = User::find($id);
$user->name = $request->name;
$user->save();
}
public static function updatePassword($request, $id) {
$user = User::find($id);
$user->password = Hash::make($request->newpassword);
$user->save();
}
/* Student Register */
public static function register($request)
{
$data = new User();
$data->name = $request->name;
$data->email = $request->email;
$data->password = Hash::make($request->password);
$data->role = config('const.studentRole');
$data->save();
return $data;
}
}

View File

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

View File

@@ -0,0 +1,30 @@
<?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.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

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

View File

@@ -0,0 +1,42 @@
<?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.
*
* @return void
*/
public function boot()
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}

View File

@@ -0,0 +1,52 @@
<?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 = '/admin/dashboard';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*
* @return void
*/
public function boot()
{
$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.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Services;
use App\Models\Exam;
use App\Models\Plan;
use App\Models\Subject;
use App\Models\Test;
use App\Models\Country;
use App\Models\State;
class CommonService {
/* Get Total Count of Exam */
public static function totalExam() {
return Exam::all()->count();
}
/* Get Total Count of Plan */
public static function totalPlan() {
return Plan::all()->count();
}
/* Get Total Count of Plan */
public static function totalSubject() {
return Subject::all()->count();
}
/* Get Total Count of Plan */
public static function totalTest() {
return Test::all()->count();
}
/* Get Total Country */
public static function totalCountry() {
return Country::all()->count();
}
/* Get Total State */
public static function totalState() {
return State::all()->count();
}
}

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,606 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 17, 2022 at 12:29 PM
-- Server version: 10.4.25-MariaDB
-- PHP Version: 8.0.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `auschooltest`
--
-- --------------------------------------------------------
--
-- Table structure for table `city`
--
CREATE TABLE `city` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`country_id` bigint(20) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `city`
--
INSERT INTO `city` (`id`, `name`, `country_id`, `created_at`, `updated_at`) VALUES
(1, 'NSW', 1, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `country`
--
CREATE TABLE `country` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `country`
--
INSERT INTO `country` (`id`, `name`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Australia', '2022-11-27 10:43:36', '2022-11-30 13:52:41', NULL),
(2, 'India', '2022-11-27 10:02:08', '2022-11-30 13:38:49', NULL),
(3, 'America', '2022-11-27 10:36:28', '2022-11-30 13:50:47', NULL),
(4, 'UK', '2022-11-27 11:21:00', '2022-12-02 12:32:17', '2022-12-02 12:32:17');
-- --------------------------------------------------------
--
-- Table structure for table `exam`
--
CREATE TABLE `exam` (
`id` bigint(20) UNSIGNED NOT NULL,
`exam_category_id` bigint(20) UNSIGNED NOT NULL,
`country_id` bigint(20) UNSIGNED NOT NULL,
`state_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `exam`
--
INSERT INTO `exam` (`id`, `exam_category_id`, `country_id`, `state_id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 2, 3, 'NPLAN', 'This is NAPLAN', '2022-11-29 13:16:56', '2022-12-01 10:26:16', NULL),
(2, 2, 1, 2, 'NPLAN 2', 'This is Test Demo', '2022-11-30 11:40:17', '2022-11-30 11:40:17', NULL),
(3, 2, 2, 3, 'NPLAN 3', 'This is NAPLAN', '2022-11-30 11:44:58', '2022-11-30 12:42:31', NULL),
(4, 1, 3, 4, 'NPLAN 4', 'This is NPLAN 4', '2022-12-01 10:27:49', '2022-12-02 13:11:16', NULL),
(5, 3, 3, 4, 'NPLAN Exam', 'Testwet', '2022-12-03 04:45:36', '2022-12-03 04:45:36', NULL),
(6, 1, 2, 3, 'America', 'test', '2022-12-04 01:12:59', '2022-12-04 01:13:13', '2022-12-04 01:13:13');
-- --------------------------------------------------------
--
-- Table structure for table `exam_category`
--
CREATE TABLE `exam_category` (
`id` bigint(20) UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `exam_category`
--
INSERT INTO `exam_category` (`id`, `title`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Category', '2022-11-28 13:00:13', '2022-11-28 13:17:08', NULL),
(2, 'Category 2', '2022-11-28 13:01:59', '2022-11-30 12:56:27', NULL),
(3, 'Category 3', '2022-12-02 12:37:00', '2022-12-02 12:37:36', NULL),
(4, 'Category 4', '2022-12-03 04:44:23', '2022-12-05 11:56:51', '2022-12-05 11:56:51');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2022_11_26_083707_add_colunm_to_users_table', 2),
(6, '2022_11_26_190814_change_colounm_size_password_resets_table', 3),
(7, '2022_11_26_194150_add_colunm_to_password_resets_table', 4),
(8, '2022_11_27_082949_create_plans_table', 5),
(9, '2022_11_27_085822_create_country_table', 5),
(10, '2022_11_27_085937_creat_city_table', 6),
(11, '2022_11_27_120108_create_state_table', 7),
(12, '2022_11_27_174609_add_colunm_to_country', 8),
(13, '2022_11_28_164122_add_colunm_to_state_table', 9),
(14, '2022_11_28_175105_create_exam_category_table', 10),
(15, '2022_11_29_160620_create_exam_table', 11),
(16, '2022_11_29_181715_add_colunm_to_exam_table', 12),
(17, '2022_12_01_171004_add_colunm_to_plans_table', 13),
(18, '2022_12_01_174704_create_plans_table', 14),
(19, '2022_12_01_180824_add_colunm_to_plans_table', 15),
(20, '2022_12_02_184735_create_subjects_table', 16),
(21, '2022_12_03_062303_create_test_table', 17),
(22, '2022_12_03_081541_add_colunm_to_subject_table', 18),
(23, '2022_12_03_134412_add_colunm_to_plans_table', 19),
(24, '2022_12_04_071758_create_test_question_table', 20),
(26, '2022_12_11_114751_add_colunm_to_test_question', 21);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `personal_access_tokens`
--
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) UNSIGNED NOT NULL,
`tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`abilities` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_used_at` timestamp NULL DEFAULT NULL,
`expires_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `plans`
--
CREATE TABLE `plans` (
`id` bigint(20) UNSIGNED NOT NULL,
`exam_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`year` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`validity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`unlimited_test_attempt` tinyint(4) NOT NULL COMMENT '1-yes,0-no',
`attempt` int(11) DEFAULT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `plans`
--
INSERT INTO `plans` (`id`, `exam_id`, `name`, `year`, `price`, `validity`, `unlimited_test_attempt`, `attempt`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, '3 Year', '3', '2000', '356', 0, 5, 'aeqwe', '2022-12-01 13:24:46', '2022-12-03 12:04:51', NULL),
(2, 2, '6 year', '6', '5000', '450', 0, 2, 'Test', '2022-12-01 13:55:51', '2022-12-02 13:14:57', NULL),
(3, 4, '4', '4', '500', '365', 1, NULL, 'This is NPLAN 4 Plan', '2022-12-03 11:27:00', '2022-12-03 12:05:59', NULL),
(4, 1, 'English', '3', '200', '356', 1, NULL, 'test', '2022-12-04 01:14:17', '2022-12-04 01:14:17', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `state`
--
CREATE TABLE `state` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`country_id` bigint(20) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `state`
--
INSERT INTO `state` (`id`, `name`, `country_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'sydney', 1, '2022-11-28 11:53:11', '2022-11-28 12:13:33', NULL),
(2, 'Perth', 1, '2022-11-28 11:53:48', '2022-11-28 12:14:47', NULL),
(3, 'Gujrat', 2, '2022-11-28 11:54:05', '2022-11-28 12:12:51', NULL),
(4, 'California', 3, '2022-12-01 10:27:09', '2022-12-01 10:27:09', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE `subjects` (
`id` bigint(20) UNSIGNED NOT NULL,
`plan_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `subjects`
--
INSERT INTO `subjects` (`id`, `plan_id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'English', 'This is English Subject', '2022-12-02 14:02:36', '2022-12-03 02:55:47', NULL),
(2, 1, 'Medium English', 'This is Medium English', '2022-12-03 00:47:58', '2022-12-03 03:20:15', NULL),
(3, 1, 'Mathematics', 'This is Mathematics', '2022-12-03 00:48:29', '2022-12-03 03:18:47', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `test`
--
CREATE TABLE `test` (
`id` bigint(20) UNSIGNED NOT NULL,
`subject_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `test`
--
INSERT INTO `test` (`id`, `subject_id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'English Test', 'This is English Test', '2022-12-03 06:36:42', '2022-12-03 08:02:40', NULL),
(2, 2, 'Medium English Test', 'This is Medium English Test', '2022-12-03 06:59:12', '2022-12-03 06:59:12', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `test_question`
--
CREATE TABLE `test_question` (
`id` bigint(20) UNSIGNED NOT NULL,
`test_id` bigint(20) UNSIGNED NOT NULL,
`question_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`question` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`question_image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`option_1` text COLLATE utf8mb4_unicode_ci NOT NULL,
`option_2` text COLLATE utf8mb4_unicode_ci NOT NULL,
`option_3` text COLLATE utf8mb4_unicode_ci NOT NULL,
`option_4` text COLLATE utf8mb4_unicode_ci NOT NULL,
`true_answer` text COLLATE utf8mb4_unicode_ci NOT NULL,
`solution` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`role` tinyint(4) NOT NULL COMMENT '1-admin,2-student',
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `role`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'auschooladmin@yopmail.com', NULL, '$2y$10$V6qT1fPyObzGhZt6Ikx5jODtwUDftYIIYb/go.kCOOskDe5pkRDNW', 1, NULL, '2022-12-09 13:22:09', '2022-12-09 13:22:09'),
(2, 'Student1', 'student1@yopmail.com', NULL, '$2y$10$6WdD7dhhkyNkxeNRIGzxUeKt/vy2GHGQb2fS/5tUC6RpBoPMl1RWG', 2, NULL, '2022-12-09 13:24:26', '2022-12-10 06:34:49'),
(3, 'Student3', 'student3@yopmail.com', NULL, '$2y$10$3kgWdumLNbb0f/TwlBjVwuVuR4tT73KIp8Oa3v3/2dn5r.XGlMrKy', 2, NULL, '2022-12-09 13:34:49', '2022-12-09 13:34:49'),
(4, 'Student4', 'student4@yopmail.com', NULL, '$2y$10$Wl1W5R7Rger/RbHlHzX83eJTlweQe62pV4dN/Z8blq7jstaEJV8rO', 2, NULL, '2022-12-09 13:56:19', '2022-12-09 13:56:19'),
(5, 'Student5', 'student5@yopmail.com', NULL, '$2y$10$vVQODFOJtTmK0dPK6Ru9h.1SQLjRB4bqrZbHZaptIAMu7phc3HLxu', 2, NULL, '2022-12-09 13:57:58', '2022-12-09 13:57:58'),
(6, 'Student 2', 'student2@yopmail.com', NULL, '$2y$10$jJRxB.izbJoPhZK9n7GBDeLOpAXCG.6RvMADUKtM4iDowUgDKZzMC', 2, NULL, '2022-12-10 01:14:17', '2022-12-10 01:14:17');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `city`
--
ALTER TABLE `city`
ADD PRIMARY KEY (`id`),
ADD KEY `city_country_id_foreign` (`country_id`);
--
-- Indexes for table `country`
--
ALTER TABLE `country`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `exam`
--
ALTER TABLE `exam`
ADD PRIMARY KEY (`id`),
ADD KEY `exam_exam_category_id_foreign` (`exam_category_id`),
ADD KEY `exam_country_id_foreign` (`country_id`),
ADD KEY `exam_state_id_foreign` (`state_id`);
--
-- Indexes for table `exam_category`
--
ALTER TABLE `exam_category`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);
--
-- Indexes for table `plans`
--
ALTER TABLE `plans`
ADD PRIMARY KEY (`id`),
ADD KEY `plans_exam_id_foreign` (`exam_id`);
--
-- Indexes for table `state`
--
ALTER TABLE `state`
ADD PRIMARY KEY (`id`),
ADD KEY `state_country_id_foreign` (`country_id`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`id`),
ADD KEY `subjects_plan_id_foreign` (`plan_id`);
--
-- Indexes for table `test`
--
ALTER TABLE `test`
ADD PRIMARY KEY (`id`),
ADD KEY `test_subject_id_foreign` (`subject_id`);
--
-- Indexes for table `test_question`
--
ALTER TABLE `test_question`
ADD PRIMARY KEY (`id`),
ADD KEY `test_question_test_id_foreign` (`test_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `city`
--
ALTER TABLE `city`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `country`
--
ALTER TABLE `country`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `exam`
--
ALTER TABLE `exam`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `exam_category`
--
ALTER TABLE `exam_category`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `plans`
--
ALTER TABLE `plans`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `state`
--
ALTER TABLE `state`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `test`
--
ALTER TABLE `test`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `test_question`
--
ALTER TABLE `test_question`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `city`
--
ALTER TABLE `city`
ADD CONSTRAINT `city_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`);
--
-- Constraints for table `exam`
--
ALTER TABLE `exam`
ADD CONSTRAINT `exam_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
ADD CONSTRAINT `exam_exam_category_id_foreign` FOREIGN KEY (`exam_category_id`) REFERENCES `exam_category` (`id`),
ADD CONSTRAINT `exam_state_id_foreign` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`);
--
-- Constraints for table `plans`
--
ALTER TABLE `plans`
ADD CONSTRAINT `plans_exam_id_foreign` FOREIGN KEY (`exam_id`) REFERENCES `exam` (`id`);
--
-- Constraints for table `state`
--
ALTER TABLE `state`
ADD CONSTRAINT `state_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`);
--
-- Constraints for table `subjects`
--
ALTER TABLE `subjects`
ADD CONSTRAINT `subjects_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`);
--
-- Constraints for table `test`
--
ALTER TABLE `test`
ADD CONSTRAINT `test_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`);
--
-- Constraints for table `test_question`
--
ALTER TABLE `test_question`
ADD CONSTRAINT `test_question_test_id_foreign` FOREIGN KEY (`test_id`) REFERENCES `test` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

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

View File

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

View File

@@ -0,0 +1,68 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"doctrine/dbal": "^3.5",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/ui": "^4.1",
"yajra/laravel-datatables": "9.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.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
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,216 @@
<?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' => 'asia/hong_kong',
/*
|--------------------------------------------------------------------------
| 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...
*/
Yajra\DataTables\DataTablesServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::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,
'DataTables' => Yajra\DataTables\Facades\DataTables::class,
])->toArray(),
];

View File

@@ -0,0 +1,111 @@
<?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 expire 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.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'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,70 @@
<?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,110 @@
<?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,7 @@
<?php
return [
'superAdminEmail'=>'auschooladmin@yopmail.com',
'password'=>'12345678',
'studentRole' =>2
];
?>

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,52 @@
<?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,122 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
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'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'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'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

View File

@@ -0,0 +1,118 @@
<?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",
| "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',
],
'postmark' => [
'transport' => 'postmark',
],
'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,93 @@
<?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,67 @@
<?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,34 @@
<?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,201 @@
<?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,36 @@
<?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,40 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return static
*/
public function unverified()
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->tinyInteger('role')->after("password");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up() {
Schema::table('password_resets', function (Blueprint $table) {
$table->text('token')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down() {
//
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('password_resets', function (Blueprint $table) {
$table->timestamp('updated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('password_resets', function (Blueprint $table) {
//
});
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('country', function (Blueprint $table) {
$table->id();
$table->string("name");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('country');
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('city', function (Blueprint $table) {
$table->id();
$table->string("name");
$table->unsignedBigInteger('country_id');
$table->foreign('country_id')->references('id')->on('country');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('city');
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('state', function (Blueprint $table) {
$table->id();
$table->string("name");
$table->unsignedBigInteger('country_id');
$table->foreign('country_id')->references('id')->on('country');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('state');
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Eloquent\SoftDeletes;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('country', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('country', function (Blueprint $table) {
//
});
}
};

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