commit
957d34c501
18
.editorconfig
Normal file
18
.editorconfig
Normal file
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
52
.env.example
Normal file
52
.env.example
Normal file
|
@ -0,0 +1,52 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=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=null
|
||||
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_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
* 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
|
24
.gitignore
vendored
24
.gitignore
vendored
|
@ -1,8 +1,16 @@
|
|||
# 禁止上传的目录
|
||||
/node_modules/
|
||||
/package.json
|
||||
/package-lock.json
|
||||
/build/
|
||||
/.htaccess
|
||||
/.user.ini
|
||||
/idea/
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
docker-compose.override.yml
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
/tests/
|
||||
|
|
14
.styleci.yml
Normal file
14
.styleci.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
php:
|
||||
preset: laravel
|
||||
version: 8
|
||||
disabled:
|
||||
- no_unused_imports
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-2023 筱锋xiao_lfeng
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
$Array_ConfigData = null;
|
||||
|
||||
// 从配置文件获取参数
|
||||
$FileData = fopen(dirname(__FILE__, 3) . "/setting.inc.json", 'r');
|
||||
while (!feof($FileData))
|
||||
$Array_ConfigData .= fgetc($FileData);
|
||||
$Array_ConfigData = json_decode($Array_ConfigData, JSON_UNESCAPED_UNICODE);
|
||||
fclose($FileData);
|
65
README.md
65
README.md
|
@ -1 +1,64 @@
|
|||
# XF_Index
|
||||
<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"></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.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 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).
|
||||
|
|
37
app/Console/Kernel.php
Normal file
37
app/Console/Kernel.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
46
app/Exceptions/Handler.php
Normal file
46
app/Exceptions/Handler.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* 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 for 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) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
70
app/Http/Controllers/Authme.php
Normal file
70
app/Http/Controllers/Authme.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class Authme extends Authenticatable
|
||||
{
|
||||
public function Register(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'username' => 'required',
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required|min:6|confirmed',
|
||||
]);
|
||||
|
||||
$user = new User();
|
||||
$user->username = $request->username;
|
||||
$user->email = $request->email;
|
||||
$user->password = bcrypt($request->password);
|
||||
$user->save();
|
||||
auth()->login($user);
|
||||
|
||||
$jsonData = [
|
||||
'output' => 'Success',
|
||||
'code' => 200,
|
||||
'data' => [
|
||||
'message' => '登陆成功',
|
||||
],
|
||||
];
|
||||
|
||||
return Response::json($jsonData);
|
||||
}
|
||||
|
||||
public function Login(Request $request): JsonResponse
|
||||
{
|
||||
// 获取参数
|
||||
$loginData = $request->only('email','password');
|
||||
if (Auth::attempt($loginData,true)) {
|
||||
// 登录成功
|
||||
$jsonData = [
|
||||
'output' => 'Success',
|
||||
'code' => 200,
|
||||
'data' => [
|
||||
'message' => '登陆成功',
|
||||
],
|
||||
];
|
||||
} else {
|
||||
// 登陆失败
|
||||
$jsonData = [
|
||||
'output' => 'LoginFail',
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => '登陆失败',
|
||||
],
|
||||
];
|
||||
}
|
||||
return Response::json($jsonData);
|
||||
}
|
||||
}
|
18
app/Http/Controllers/Controller.php
Normal file
18
app/Http/Controllers/Controller.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
89
app/Http/Kernel.php
Normal file
89
app/Http/Kernel.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Http\Middleware\Authenticate;
|
||||
use App\Http\Middleware\EncryptCookies;
|
||||
use App\Http\Middleware\RedirectIfAuthenticated;
|
||||
use App\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
|
||||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
|
||||
use Illuminate\Auth\Middleware\RequirePassword;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
||||
use Illuminate\Http\Middleware\SetCacheHeaders;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Illuminate\Routing\Middleware\ValidateSignature;
|
||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
||||
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 = [
|
||||
CheckForMaintenanceMode::class,
|
||||
StartSession::class,
|
||||
\Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
AuthenticateSession::class,
|
||||
// 其他中间件
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
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' => Authenticate::class,
|
||||
'auth.basic' => AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => SetCacheHeaders::class,
|
||||
'can' => Authorize::class,
|
||||
'guest' => RedirectIfAuthenticated::class,
|
||||
'password.confirm' => RequirePassword::class,
|
||||
'signed' => ValidateSignature::class,
|
||||
'throttle' => ThrottleRequests::class,
|
||||
'verified' => EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
26
app/Http/Middleware/Authenticate.php
Normal file
26
app/Http/Middleware/Authenticate.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
22
app/Http/Middleware/EncryptCookies.php
Normal file
22
app/Http/Middleware/EncryptCookies.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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 = [
|
||||
//
|
||||
];
|
||||
}
|
22
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
22
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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 = [
|
||||
//
|
||||
];
|
||||
}
|
37
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
37
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
24
app/Http/Middleware/TrimStrings.php
Normal file
24
app/Http/Middleware/TrimStrings.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
25
app/Http/Middleware/TrustHosts.php
Normal file
25
app/Http/Middleware/TrustHosts.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
33
app/Http/Middleware/TrustProxies.php
Normal file
33
app/Http/Middleware/TrustProxies.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
22
app/Http/Middleware/VerifyCsrfToken.php
Normal file
22
app/Http/Middleware/VerifyCsrfToken.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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 = [
|
||||
//
|
||||
];
|
||||
}
|
48
app/Models/User.php
Normal file
48
app/Models/User.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'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',
|
||||
];
|
||||
}
|
34
app/Providers/AppServiceProvider.php
Normal file
34
app/Providers/AppServiceProvider.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
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()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
}
|
34
app/Providers/AuthServiceProvider.php
Normal file
34
app/Providers/AuthServiceProvider.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The 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();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
26
app/Providers/BroadcastServiceProvider.php
Normal file
26
app/Providers/BroadcastServiceProvider.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
36
app/Providers/EventServiceProvider.php
Normal file
36
app/Providers/EventServiceProvider.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event 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()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
68
app/Providers/RouteServiceProvider.php
Normal file
68
app/Providers/RouteServiceProvider.php
Normal file
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
// protected $namespace = 'App\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->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(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
53
artisan
Normal file
53
artisan
Normal 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);
|
60
bootstrap/app.php
Normal file
60
bootstrap/app.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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;
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
class Key
|
||||
{
|
||||
/**
|
||||
* 生成验证码
|
||||
* 说明:
|
||||
*
|
||||
* 1. [type(string)]
|
||||
* - [Number] 数字验证码
|
||||
* - [English]英文验证码
|
||||
* - [Normal] 混合验证码
|
||||
* @param int $long 验证码长度
|
||||
* @param string $type 验证码类型
|
||||
* @return string 返回结果为生成的验证码
|
||||
*/
|
||||
public static function Captcha(int $long, string $type = 'Number'): string
|
||||
{
|
||||
/** @var string $output */
|
||||
for ($i = 1; $i <= $long; $i++) {
|
||||
if ($type == 'Number') {
|
||||
$output = $output . rand(0, 9);
|
||||
} elseif ($type == 'English') {
|
||||
$output = $output . chr(rand(65, 90));
|
||||
} elseif ($type == 'Normal') {
|
||||
if (time() % 2 == 0) {
|
||||
if ($i % 2 == 0) {
|
||||
$output = $output . chr(rand(65, 90));
|
||||
} else {
|
||||
$output = $output . rand(0, 9);
|
||||
}
|
||||
} else {
|
||||
if ($i % 3 != 0) {
|
||||
$output = $output . chr(rand(65, 90));
|
||||
} else {
|
||||
$output = $output . rand(0, 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer;
|
||||
|
||||
class MailTemplate
|
||||
{
|
||||
private static string $GCode;
|
||||
private static int $NowTime;
|
||||
|
||||
/**
|
||||
* 检查使用邮件发送模板
|
||||
* @param string $G_code 获取后端发送来的验证码用于发送
|
||||
* @return string|null 需要返回值,返回HTML信息给邮箱模板用于发送
|
||||
*/
|
||||
public static function Templates(string $G_code): ?string
|
||||
{
|
||||
// 赋值给全局
|
||||
self::$GCode = $G_code;
|
||||
self::$NowTime = time();
|
||||
|
||||
// 判断发送内容
|
||||
if (SendMail::$EmailType == 1) return self::Register();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册邮件模板
|
||||
* @return string 返回 HTML 方式的 Mail
|
||||
*/
|
||||
private static function Register(): string
|
||||
{
|
||||
// 变量获取
|
||||
$getTitle = SendMail::$WebTitle;
|
||||
$getNowTime = self::$NowTime;
|
||||
$getReceiver = SendMail::$EmailReceiver;
|
||||
$getEndTime = date("Y年m月d日 H:i:s", time() + SendMail::$ExpTime);
|
||||
$getExpTime = (double)SendMail::$ExpTime / 60;
|
||||
$getYear = date('Y');
|
||||
$getDomain = $_SERVER['SERVER_NAME'];
|
||||
// 结果返回
|
||||
return <<<EOF
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Mail</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
</head>
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;border: 1px solid #cccccc;box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175)">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#70bbd9" style="padding: 30px 0 30px 0; font-size: 30px;">$getTitle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding: 30px 30px 30px 30px;">
|
||||
<tr>
|
||||
<td style="padding: 10px 0px 30px 0px;color: #08212b; font-family: Arial, sans-serif; font-size: 10px;">
|
||||
发送时间: <b>$getNowTime</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0px 0px 10px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 24px;">
|
||||
Dear. <a style="text-decoration: none;color: #198754;" href="mailto:$getReceiver">$getReceiver</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0px 5px 5px 0px;color: #000000; font-family: Arial, sans-serif; font-size: 20px;">
|
||||
<a href="$getDomain/account/activation.php"><button style="background-color: #008CBA;font-size: 16px;border-radius: 8px;">点击激活</button></a>
|
||||
<br/>
|
||||
您的身份激活 <strong>$getExpTime</strong> 分钟内有效,此身份激活为 <strong>账户注册</strong> 使用。<br/>
|
||||
有效期至:$getEndTime
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#f0f0f0" style="padding: 30px 20px 30px 20px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td style="font-family: Arial, sans-serif; font-size: 14px;">
|
||||
<font style="color: grey;">© 2022 - $getYear. $getTitle All Rights Reserved.</font><br/>
|
||||
<font style="color: grey;">本邮件为自动发出,请勿直接回复</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td style="padding: 30px 0 20px 0;"></td>
|
||||
</tr>
|
||||
</html>
|
||||
EOF;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,233 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* Configure PHPMailer with DSN string.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Data_source_name
|
||||
*
|
||||
* @author Oleg Voronkovich <oleg-voronkovich@yandex.ru>
|
||||
*/
|
||||
class DSNConfigurator
|
||||
{
|
||||
/**
|
||||
* Create new PHPMailer instance configured by DSN.
|
||||
*
|
||||
* @param string $dsn DSN
|
||||
* @param bool $exceptions Should we throw external exceptions?
|
||||
*
|
||||
* @return PHPMailer
|
||||
*/
|
||||
public static function mailer($dsn, $exceptions = null)
|
||||
{
|
||||
static $configurator = null;
|
||||
|
||||
if (null === $configurator) {
|
||||
$configurator = new DSNConfigurator();
|
||||
}
|
||||
|
||||
return $configurator->configure(new PHPMailer($exceptions), $dsn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure PHPMailer instance with DSN string.
|
||||
*
|
||||
* @param PHPMailer $mailer PHPMailer instance
|
||||
* @param string $dsn DSN
|
||||
*
|
||||
* @return PHPMailer
|
||||
*/
|
||||
public function configure(PHPMailer $mailer, $dsn)
|
||||
{
|
||||
$config = $this->parseDSN($dsn);
|
||||
|
||||
$this->applyConfig($mailer, $config);
|
||||
|
||||
return $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse DSN string.
|
||||
*
|
||||
* @param string $dsn DSN
|
||||
*
|
||||
* @return array Configuration
|
||||
* @throws Exception If DSN is malformed
|
||||
*
|
||||
*/
|
||||
private function parseDSN($dsn)
|
||||
{
|
||||
$config = $this->parseUrl($dsn);
|
||||
|
||||
if (false === $config || !isset($config['scheme']) || !isset($config['host'])) {
|
||||
throw new Exception(
|
||||
sprintf('Malformed DSN: "%s".', $dsn)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($config['query'])) {
|
||||
parse_str($config['query'], $config['query']);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply configuration to mailer.
|
||||
*
|
||||
* @param PHPMailer $mailer PHPMailer instance
|
||||
* @param array $config Configuration
|
||||
*
|
||||
* @throws Exception If scheme is invalid
|
||||
*/
|
||||
private function applyConfig(PHPMailer $mailer, $config)
|
||||
{
|
||||
switch ($config['scheme']) {
|
||||
case 'mail':
|
||||
$mailer->isMail();
|
||||
break;
|
||||
case 'sendmail':
|
||||
$mailer->isSendmail();
|
||||
break;
|
||||
case 'qmail':
|
||||
$mailer->isQmail();
|
||||
break;
|
||||
case 'smtp':
|
||||
case 'smtps':
|
||||
$mailer->isSMTP();
|
||||
$this->configureSMTP($mailer, $config);
|
||||
break;
|
||||
default:
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
'Invalid scheme: "%s". Allowed values: "mail", "sendmail", "qmail", "smtp", "smtps".',
|
||||
$config['scheme']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($config['query'])) {
|
||||
$this->configureOptions($mailer, $config['query']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure SMTP.
|
||||
*
|
||||
* @param PHPMailer $mailer PHPMailer instance
|
||||
* @param array $config Configuration
|
||||
*/
|
||||
private function configureSMTP($mailer, $config)
|
||||
{
|
||||
$isSMTPS = 'smtps' === $config['scheme'];
|
||||
|
||||
if ($isSMTPS) {
|
||||
$mailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||
}
|
||||
|
||||
$mailer->Host = $config['host'];
|
||||
|
||||
if (isset($config['port'])) {
|
||||
$mailer->Port = $config['port'];
|
||||
} elseif ($isSMTPS) {
|
||||
$mailer->Port = SMTP::DEFAULT_SECURE_PORT;
|
||||
}
|
||||
|
||||
$mailer->SMTPAuth = isset($config['user']) || isset($config['pass']);
|
||||
|
||||
if (isset($config['user'])) {
|
||||
$mailer->Username = $config['user'];
|
||||
}
|
||||
|
||||
if (isset($config['pass'])) {
|
||||
$mailer->Password = $config['pass'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure options.
|
||||
*
|
||||
* @param PHPMailer $mailer PHPMailer instance
|
||||
* @param array $options Options
|
||||
*
|
||||
* @throws Exception If option is unknown
|
||||
*/
|
||||
private function configureOptions(PHPMailer $mailer, $options)
|
||||
{
|
||||
$allowedOptions = get_object_vars($mailer);
|
||||
|
||||
unset($allowedOptions['Mailer']);
|
||||
unset($allowedOptions['SMTPAuth']);
|
||||
unset($allowedOptions['Username']);
|
||||
unset($allowedOptions['Password']);
|
||||
unset($allowedOptions['Hostname']);
|
||||
unset($allowedOptions['Port']);
|
||||
unset($allowedOptions['ErrorInfo']);
|
||||
|
||||
$allowedOptions = \array_keys($allowedOptions);
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
if (!in_array($key, $allowedOptions)) {
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
'Unknown option: "%s". Allowed values: "%s"',
|
||||
$key,
|
||||
implode('", "', $allowedOptions)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
switch ($key) {
|
||||
case 'AllowEmpty':
|
||||
case 'SMTPAutoTLS':
|
||||
case 'SMTPKeepAlive':
|
||||
case 'SingleTo':
|
||||
case 'UseSendmailOptions':
|
||||
case 'do_verp':
|
||||
case 'DKIM_copyHeaderFields':
|
||||
$mailer->$key = (bool)$value;
|
||||
break;
|
||||
case 'Priority':
|
||||
case 'SMTPDebug':
|
||||
case 'WordWrap':
|
||||
$mailer->$key = (int)$value;
|
||||
break;
|
||||
default:
|
||||
$mailer->$key = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a URL.
|
||||
* Wrapper for the built-in parse_url function to work around a bug in PHP 5.5.
|
||||
*
|
||||
* @param string $url URL
|
||||
*
|
||||
* @return array|false
|
||||
*/
|
||||
protected function parseUrl($url)
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) {
|
||||
return parse_url($url);
|
||||
}
|
||||
|
||||
$chunks = explode('?', $url);
|
||||
if (is_array($chunks)) {
|
||||
$result = parse_url($chunks[0]);
|
||||
if (is_array($result)) {
|
||||
$result['query'] = $chunks[1];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer exception handler.
|
||||
*
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* Prettify error message output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function errorMessage()
|
||||
{
|
||||
return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
|
||||
}
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
|
||||
use League\OAuth2\Client\Grant\RefreshToken;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
|
||||
/**
|
||||
* OAuth - OAuth2 authentication wrapper class.
|
||||
* Uses the oauth2-client package from the League of Extraordinary Packages.
|
||||
*
|
||||
* @see http://oauth2-client.thephpleague.com
|
||||
*
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
class OAuth implements OAuthTokenProvider
|
||||
{
|
||||
/**
|
||||
* An instance of the League OAuth Client Provider.
|
||||
*
|
||||
* @var AbstractProvider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The current OAuth access token.
|
||||
*
|
||||
* @var AccessToken
|
||||
*/
|
||||
protected $oauthToken;
|
||||
|
||||
/**
|
||||
* The user's email address, usually used as the login ID
|
||||
* and also the from address when sending email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthUserEmail = '';
|
||||
|
||||
/**
|
||||
* The client secret, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* The client ID, generated in the app definition of the service you're connecting to.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* The refresh token, used to obtain new AccessTokens.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $oauthRefreshToken = '';
|
||||
|
||||
/**
|
||||
* OAuth constructor.
|
||||
*
|
||||
* @param array $options Associative array containing
|
||||
* `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$this->provider = $options['provider'];
|
||||
$this->oauthUserEmail = $options['userName'];
|
||||
$this->oauthClientSecret = $options['clientSecret'];
|
||||
$this->oauthClientId = $options['clientId'];
|
||||
$this->oauthRefreshToken = $options['refreshToken'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new RefreshToken.
|
||||
*
|
||||
* @return RefreshToken
|
||||
*/
|
||||
protected function getGrant()
|
||||
{
|
||||
return new RefreshToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new AccessToken.
|
||||
*
|
||||
* @return AccessToken
|
||||
*/
|
||||
protected function getToken()
|
||||
{
|
||||
return $this->provider->getAccessToken(
|
||||
$this->getGrant(),
|
||||
['refresh_token' => $this->oauthRefreshToken]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a base64-encoded OAuth token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOauth64()
|
||||
{
|
||||
//Get a new token if it's not available or has expired
|
||||
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
||||
$this->oauthToken = $this->getToken();
|
||||
}
|
||||
|
||||
return base64_encode(
|
||||
'user=' .
|
||||
$this->oauthUserEmail .
|
||||
"\001auth=Bearer " .
|
||||
$this->oauthToken .
|
||||
"\001\001"
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* OAuthTokenProvider - OAuth2 token provider interface.
|
||||
* Provides base64 encoded OAuth2 auth strings for SMTP authentication.
|
||||
*
|
||||
* @see OAuth
|
||||
* @see SMTP::authenticate()
|
||||
*
|
||||
* @author Peter Scopes (pdscopes)
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
*/
|
||||
interface OAuthTokenProvider
|
||||
{
|
||||
/**
|
||||
* Generate a base64-encoded OAuth token ensuring that the access token has not expired.
|
||||
* The string to be base 64 encoded should be in the form:
|
||||
* "user=<user_email_address>\001auth=Bearer <access_token>\001\001"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOauth64();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,454 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* 1) This class does not support APOP authentication.
|
||||
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
|
||||
* to send a batch of emails then just perform the authentication once at the start,
|
||||
* and then loop through your mail sending script. Providing this process doesn't
|
||||
* take longer than the verification period lasts on your POP3 server, you should be fine.
|
||||
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
|
||||
* 4) This POP3 class is deliberately lightweight and incomplete, implementing just
|
||||
* enough to do authentication.
|
||||
* If you want a more complete class there are other POP3 classes for PHP available.
|
||||
*
|
||||
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
||||
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
||||
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
||||
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
||||
*/
|
||||
class POP3
|
||||
{
|
||||
/**
|
||||
* The POP3 PHPMailer Version number.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '6.8.0';
|
||||
|
||||
/**
|
||||
* Default POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_PORT = 110;
|
||||
|
||||
/**
|
||||
* Default timeout in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEFAULT_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* POP3 class debug output mode.
|
||||
* Debug output level.
|
||||
* Options:
|
||||
* @see POP3::DEBUG_OFF: No output
|
||||
* @see POP3::DEBUG_SERVER: Server messages, connection/server errors
|
||||
* @see POP3::DEBUG_CLIENT: Client and Server messages, connection/server errors
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $do_debug = self::DEBUG_OFF;
|
||||
|
||||
/**
|
||||
* POP3 mail server hostname.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $host;
|
||||
|
||||
/**
|
||||
* POP3 port number.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $port;
|
||||
|
||||
/**
|
||||
* POP3 Timeout Value in seconds.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tval;
|
||||
|
||||
/**
|
||||
* POP3 username.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* POP3 password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* Resource handle for the POP3 connection socket.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
protected $pop_conn;
|
||||
|
||||
/**
|
||||
* Are we connected?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $connected = false;
|
||||
|
||||
/**
|
||||
* Error container.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* Line break constant.
|
||||
*/
|
||||
const LE = "\r\n";
|
||||
|
||||
/**
|
||||
* Debug level for no output.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEBUG_OFF = 0;
|
||||
|
||||
/**
|
||||
* Debug level to show server -> client messages
|
||||
* also shows clients connection errors or errors from server
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEBUG_SERVER = 1;
|
||||
|
||||
/**
|
||||
* Debug level to show client -> server and server -> client messages.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const DEBUG_CLIENT = 2;
|
||||
|
||||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
)
|
||||
{
|
||||
$pop = new self();
|
||||
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate with a POP3 server.
|
||||
* A connect, login, disconnect sequence
|
||||
* appropriate for POP-before SMTP authorisation.
|
||||
*
|
||||
* @param string $host The hostname to connect to
|
||||
* @param int|bool $port The port number to connect to
|
||||
* @param int|bool $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $debug_level
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||
{
|
||||
$this->host = $host;
|
||||
//If no port value provided, use default
|
||||
if (false === $port) {
|
||||
$this->port = static::DEFAULT_PORT;
|
||||
} else {
|
||||
$this->port = (int)$port;
|
||||
}
|
||||
//If no timeout value provided, use default
|
||||
if (false === $timeout) {
|
||||
$this->tval = static::DEFAULT_TIMEOUT;
|
||||
} else {
|
||||
$this->tval = (int)$timeout;
|
||||
}
|
||||
$this->do_debug = $debug_level;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
//Reset the error log
|
||||
$this->errors = [];
|
||||
//Connect
|
||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||
if ($result) {
|
||||
$login_result = $this->login($this->username, $this->password);
|
||||
if ($login_result) {
|
||||
$this->disconnect();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//We need to disconnect regardless of whether the login succeeded
|
||||
$this->disconnect();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a POP3 server.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int|bool $port
|
||||
* @param int $tval
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function connect($host, $port = false, $tval = 30)
|
||||
{
|
||||
//Are we already connected?
|
||||
if ($this->connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
||||
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
||||
set_error_handler([$this, 'catchWarning']);
|
||||
|
||||
if (false === $port) {
|
||||
$port = static::DEFAULT_PORT;
|
||||
}
|
||||
|
||||
//Connect to the POP3 server
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
$this->pop_conn = fsockopen(
|
||||
$host, //POP3 Host
|
||||
$port, //Port #
|
||||
$errno, //Error Number
|
||||
$errstr, //Error Message
|
||||
$tval
|
||||
); //Timeout (seconds)
|
||||
//Restore the error handler
|
||||
restore_error_handler();
|
||||
|
||||
//Did we connect?
|
||||
if (false === $this->pop_conn) {
|
||||
//It would appear not...
|
||||
$this->setError(
|
||||
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Increase the stream time-out
|
||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||
|
||||
//Get the POP3 server response
|
||||
$pop3_response = $this->getResponse();
|
||||
//Check for the +OK
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
//The connection is established and the POP3 server is talking
|
||||
$this->connected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log in to the POP3 server.
|
||||
* Does not support APOP (RFC 2828, 4949).
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function login($username = '', $password = '')
|
||||
{
|
||||
if (!$this->connected) {
|
||||
$this->setError('Not connected to POP3 server');
|
||||
return false;
|
||||
}
|
||||
if (empty($username)) {
|
||||
$username = $this->username;
|
||||
}
|
||||
if (empty($password)) {
|
||||
$password = $this->password;
|
||||
}
|
||||
|
||||
//Send the Username
|
||||
$this->sendString("USER $username" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
//Send the Password
|
||||
$this->sendString("PASS $password" . static::LE);
|
||||
$pop3_response = $this->getResponse();
|
||||
if ($this->checkResponse($pop3_response)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect from the POP3 server.
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
// If could not connect at all, no need to disconnect
|
||||
if ($this->pop_conn === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->sendString('QUIT' . static::LE);
|
||||
|
||||
// RFC 1939 shows POP3 server sending a +OK response to the QUIT command.
|
||||
// Try to get it. Ignore any failures here.
|
||||
try {
|
||||
$this->getResponse();
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
//The QUIT command may cause the daemon to exit, which will kill our connection
|
||||
//So ignore errors here
|
||||
try {
|
||||
@fclose($this->pop_conn);
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
// Clean up attributes.
|
||||
$this->connected = false;
|
||||
$this->pop_conn = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a response from the POP3 server.
|
||||
*
|
||||
* @param int $size The maximum number of bytes to retrieve
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getResponse($size = 128)
|
||||
{
|
||||
$response = fgets($this->pop_conn, $size);
|
||||
if ($this->do_debug >= self::DEBUG_SERVER) {
|
||||
echo 'Server -> Client: ', $response;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw data to the POP3 server.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function sendString($string)
|
||||
{
|
||||
if ($this->pop_conn) {
|
||||
if ($this->do_debug >= self::DEBUG_CLIENT) { //Show client messages when debug >= 2
|
||||
echo 'Client -> Server: ', $string;
|
||||
}
|
||||
|
||||
return fwrite($this->pop_conn, $string, strlen($string));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the POP3 server response.
|
||||
* Looks for for +OK or -ERR.
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkResponse($string)
|
||||
{
|
||||
if (strpos($string, '+OK') !== 0) {
|
||||
$this->setError("Server reported an error: $string");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error to the internal error store.
|
||||
* Also display debug output if it's enabled.
|
||||
*
|
||||
* @param string $error
|
||||
*/
|
||||
protected function setError($error)
|
||||
{
|
||||
$this->errors[] = $error;
|
||||
if ($this->do_debug >= self::DEBUG_SERVER) {
|
||||
echo '<pre>';
|
||||
foreach ($this->errors as $e) {
|
||||
print_r($e);
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of error messages, if any.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* POP3 connection error handler.
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
*/
|
||||
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
$this->setError(
|
||||
'Connecting to the POP3 server raised a PHP warning:' .
|
||||
"errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
|
||||
);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,117 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer;
|
||||
|
||||
use Mailer\PHPMailer\Exception;
|
||||
use Mailer\PHPMailer\PHPMailer;
|
||||
|
||||
class SendMail
|
||||
{
|
||||
public static int $EmailType;
|
||||
public static string $EmailReceiver;
|
||||
|
||||
private array $ConfigData;
|
||||
public static int $ExpTime;
|
||||
public static string $WebTitle;
|
||||
|
||||
private PHPMailer $Mail;
|
||||
|
||||
/**
|
||||
* @return void 导入文件,无具体返回值
|
||||
*/
|
||||
protected function __consort()
|
||||
{
|
||||
// 文件导入
|
||||
$Array_ConfigData = null;
|
||||
$FileData = fopen(dirname(__FILE__, 3) . "/setting.inc.json", 'r');
|
||||
while (!feof($FileData))
|
||||
$Array_ConfigData .= fgetc($FileData);
|
||||
$Array_ConfigData = json_decode($Array_ConfigData, JSON_UNESCAPED_UNICODE);
|
||||
$this->ConfigData = json_decode($Array_ConfigData, JSON_UNESCAPED_UNICODE)["Smtp"];
|
||||
fclose($FileData);
|
||||
// 参数赋予
|
||||
self::$ExpTime = $Array_ConfigData["Mail"]['ExpDate'];
|
||||
self::$WebTitle = $Array_ConfigData["Web"]['Title'];
|
||||
|
||||
// 类导入
|
||||
$this->Mail = new PHPMailer(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查通信协议是 HTTP 还是 HTTPS
|
||||
* @param string $Smtp_Type [Port]获取端口值,[Secure]连接模式
|
||||
* @return mixed|string|null
|
||||
*/
|
||||
private function SSLCheck(string $Smtp_Type)
|
||||
{
|
||||
if ($Smtp_Type == 'Port')
|
||||
return $_SERVER['SERVER_PORT'] != '443' ? $this->ConfigData['Port'] : $this->ConfigData['SecurePort'];
|
||||
elseif ($Smtp_Type == 'Secure')
|
||||
if ($_SERVER['SERVER_PORT'] != '443')
|
||||
return 'TLS';
|
||||
else
|
||||
return 'ssl';
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发件基础内容(调用)
|
||||
* 说明:
|
||||
*
|
||||
* 1. [EmailType(int)] 邮件发送类型
|
||||
* - [1] 站点注册邮件
|
||||
* - [2] 站点邮件登录
|
||||
* @param string $EmailReceiver 邮件接收方(邮箱地址)
|
||||
* @param int $EmailType 发送邮件类型
|
||||
* @param string $OtherPush 其他备注内容,例如激活码
|
||||
* @return bool 邮件发送成功返回 true 否则返回 false
|
||||
*/
|
||||
public function PostMail(string $EmailReceiver, int $EmailType, string $OtherPush = null): bool
|
||||
{
|
||||
self::$EmailType = $EmailType;
|
||||
self::$EmailReceiver = $EmailReceiver;
|
||||
// 尝试邮件发送
|
||||
try {
|
||||
// 服务器配置
|
||||
$this->Mail->CharSet = "UTF-8";
|
||||
$this->Mail->SMTPDebug = 0;
|
||||
$this->Mail->isSMTP();
|
||||
$this->Mail->Host = $this->ConfigData['Host'];
|
||||
$this->Mail->SMTPAuth = $this->ConfigData['SmtpAuth'];
|
||||
$this->Mail->Username = $this->ConfigData['Username'];
|
||||
$this->Mail->Password = $this->ConfigData['Password'];
|
||||
$this->Mail->SMTPSecure = $this->SSLCheck('Secure');
|
||||
$this->Mail->Port = $this->SSLCheck('Port');
|
||||
$this->Mail->setFrom($this->ConfigData['User'], $this->ConfigData['Name']);
|
||||
$this->Mail->addAddress($EmailReceiver);
|
||||
|
||||
// 发件编写
|
||||
if ($EmailType == 1) $this->EmailRegister($OtherPush);
|
||||
else if ($EmailType == 2) $this->EmailLogin($OtherPush);
|
||||
|
||||
$this->Mail->send();
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
//echo '邮件发送失败:', $this->Mail->ErrorInfo;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private function EmailRegister(string $Input_Code): void
|
||||
{
|
||||
$this->Mail->Subject = $this->ConfigData['Name'] . ' - 站点注册'; // 邮箱标题
|
||||
$this->Mail->Body = MailTemplate::Templates($Input_Code);
|
||||
}
|
||||
|
||||
private function EmailLogin(string $OtherPush)
|
||||
{
|
||||
$this->Mail->Subject = $this->ConfigData['Name'] . ' - 邮箱登录验证码'; // 邮箱标题
|
||||
$this->Mail->Body = MailTemplate::Templates($Input_Code);
|
||||
}
|
||||
}
|
146
class/Normal.php
146
class/Normal.php
|
@ -1,146 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
class Normal
|
||||
{
|
||||
|
||||
/**
|
||||
* Json标准输出部分
|
||||
* @param int $gType 输入数字类型输出不同的段落格式
|
||||
* @param array|null $OtherArray 其他需要附带,不属于标准Json输出内容部分
|
||||
* @return void
|
||||
*/
|
||||
public static function Output(int $gType, array $OtherArray = null)
|
||||
{
|
||||
if (self::OutputMessage($gType, 1) != null) {
|
||||
$Json_Data = [
|
||||
'output' => self::OutputMessage($gType, 0),
|
||||
'code' => self::OutputMessage($gType, 1),
|
||||
'data' => [
|
||||
'statusCode' => $gType,
|
||||
'message' => self::OutputMessage($gType, 2),
|
||||
],
|
||||
];
|
||||
if (!empty($OtherArray)) {
|
||||
$Json_Data['data']['data'] = $OtherArray;
|
||||
}
|
||||
header(self::HttpStatusCode(self::OutputMessage($gType, 1)));
|
||||
} else {
|
||||
$Json_Data = [
|
||||
'output' => 'DevelopError',
|
||||
'code' => 0,
|
||||
'data' => [
|
||||
'statusCode' => 0,
|
||||
'message' => "开发错误,请查阅",
|
||||
],
|
||||
];
|
||||
header(self::HttpStatusCode(502));
|
||||
}
|
||||
// Json 输出
|
||||
echo json_encode($Json_Data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出状态监控
|
||||
* @param int $gType
|
||||
* @param int $bCode
|
||||
* @return int|string|null
|
||||
*/
|
||||
private static function OutputMessage(int $gType, int $bCode)
|
||||
{
|
||||
if ($gType == 100)
|
||||
if ($bCode == 0) return 'SessionError';
|
||||
else if ($bCode == 1) return 502;
|
||||
else return "通讯密钥为空或错误";
|
||||
else if ($gType == 200)
|
||||
if ($bCode == 0) return 'Success';
|
||||
else if ($bCode == 1) return 200;
|
||||
else return "操作成功";
|
||||
else if ($gType == 201)
|
||||
if ($bCode == 0) return 'SuccessButEmail';
|
||||
else if ($bCode == 1) return 200;
|
||||
else return "操作成功但邮件发送失败";
|
||||
else if ($gType == 300)
|
||||
if ($bCode == 0) return 'SqlInsertFail';
|
||||
else if ($bCode == 1) return 400;
|
||||
else return "数据表内容插入失败";
|
||||
else if ($gType == 310)
|
||||
if ($bCode == 0) return 'TokenTooShort';
|
||||
else if ($bCode == 1) return 502;
|
||||
else return "Token长度过短";
|
||||
else if ($gType == 311)
|
||||
if ($bCode == 0) return 'TokenTooLong';
|
||||
else if ($bCode == 1) return 502;
|
||||
else return "Token长度过长";
|
||||
else if ($gType == 400)
|
||||
if ($bCode == 0) return 'usernameFormat';
|
||||
else if ($bCode == 1) return 405;
|
||||
else return "用户名格式不符合 (格式允许0-9,A-Z,a-z及_)";
|
||||
else if ($gType == 401)
|
||||
if ($bCode == 0) return 'emailFormat';
|
||||
else if ($bCode == 1) return 405;
|
||||
else return "邮箱格式不符合";
|
||||
else if ($gType == 500)
|
||||
if ($bCode == 0) return 'CaptchaEffective';
|
||||
else if ($bCode == 1) return 200;
|
||||
else return "激活码任然有效";
|
||||
else if ($gType == 600)
|
||||
if ($bCode == 0) return 'AlReadyUser';
|
||||
else if ($bCode == 1) return 403;
|
||||
else return "已经有这个用户";
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP状态码反馈
|
||||
* @param int $Input_State 输入HTTP状态码数字
|
||||
* @return string 反馈对应 PHP 状态码 header
|
||||
*/
|
||||
private static function HttpStatusCode(int $Input_State): string
|
||||
{
|
||||
if ($Input_State == 200) return 'HTTP/1.1 200 OK';
|
||||
else if ($Input_State == 100) return 'HTTP/1.1 100 Continue';
|
||||
else if ($Input_State == 101) return 'HTTP/1.1 101 Switching Protocols';
|
||||
else if ($Input_State == 201) return 'HTTP/1.1 201 Created';
|
||||
else if ($Input_State == 202) return 'HTTP/1.1 202 Accepted';
|
||||
else if ($Input_State == 203) return 'HTTP/1.1 203 Non-Authoritative Information';
|
||||
else if ($Input_State == 204) return 'HTTP/1.1 204 No Content';
|
||||
else if ($Input_State == 205) return 'HTTP/1.1 205 Reset Content';
|
||||
else if ($Input_State == 206) return 'HTTP/1.1 206 Partial Content';
|
||||
else if ($Input_State == 300) return 'HTTP/1.1 300 Multiple Choices';
|
||||
else if ($Input_State == 301) return 'HTTP/1.1 301 Moved Permanently';
|
||||
else if ($Input_State == 302) return 'HTTP/1.1 302 Found';
|
||||
else if ($Input_State == 303) return 'HTTP/1.1 303 See Other';
|
||||
else if ($Input_State == 304) return 'HTTP/1.1 304 Not Modified';
|
||||
else if ($Input_State == 305) return 'HTTP/1.1 305 Use Proxy';
|
||||
else if ($Input_State == 307) return 'HTTP/1.1 307 Temporary Redirect';
|
||||
else if ($Input_State == 400) return 'HTTP/1.1 400 Bad Request';
|
||||
else if ($Input_State == 401) return 'HTTP/1.1 401 Unauthorized';
|
||||
else if ($Input_State == 402) return 'HTTP/1.1 402 Payment Required';
|
||||
else if ($Input_State == 403) return 'HTTP/1.1 403 Forbidden';
|
||||
else if ($Input_State == 404) return 'HTTP/1.1 404 Not Found';
|
||||
else if ($Input_State == 405) return 'HTTP/1.1 405 Method Not Allowed';
|
||||
else if ($Input_State == 406) return 'HTTP/1.1 406 Not Acceptable';
|
||||
else if ($Input_State == 407) return 'HTTP/1.1 407 Proxy Authentication Required';
|
||||
else if ($Input_State == 408) return 'HTTP/1.1 408 Request Time-out';
|
||||
else if ($Input_State == 409) return 'HTTP/1.1 409 Conflict';
|
||||
else if ($Input_State == 410) return 'HTTP/1.1 410 Gone';
|
||||
else if ($Input_State == 411) return 'HTTP/1.1 411 Length Required';
|
||||
else if ($Input_State == 412) return 'HTTP/1.1 412 Precondition Failed';
|
||||
else if ($Input_State == 413) return 'HTTP/1.1 413 Request Entity Too Large';
|
||||
else if ($Input_State == 414) return 'HTTP/1.1 414 Request-URI Too Large';
|
||||
else if ($Input_State == 415) return 'HTTP/1.1 415 Unsupported Media Type';
|
||||
else if ($Input_State == 416) return 'HTTP/1.1 416 Requested range not satisfiable';
|
||||
else if ($Input_State == 417) return 'HTTP/1.1 417 Expectation Failed';
|
||||
else if ($Input_State == 500) return 'HTTP/1.1 500 Internal Server Error';
|
||||
else if ($Input_State == 501) return 'HTTP/1.1 501 Not Implemented';
|
||||
else if ($Input_State == 502) return 'HTTP/1.1 502 Bad Gateway';
|
||||
else if ($Input_State == 503) return 'HTTP/1.1 503 Service Unavailable';
|
||||
else return 'HTTP/1.1 504 Gateway Time-out';
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
class Sql
|
||||
{
|
||||
/**
|
||||
* @return false|mysqli
|
||||
*/
|
||||
public static function MySqlConn()
|
||||
{
|
||||
// 从文件获取数据
|
||||
$Array_ConfigData = null;
|
||||
$FileData = fopen(dirname(__FILE__, 2) . "/setting.inc.json", 'r');
|
||||
while (!feof($FileData))
|
||||
$Array_ConfigData .= fgetc($FileData);
|
||||
$Array_ConfigData = json_decode($Array_ConfigData, JSON_UNESCAPED_UNICODE);
|
||||
fclose($FileData);
|
||||
|
||||
//判断数据库端口
|
||||
if ($Array_ConfigData['Mysql']['Port'] == 3306 or $Array_ConfigData['Mysql']['Port'] == NULL) $Array_ConfigData['Mysql']['Port'] = 3306;
|
||||
|
||||
return mysqli_connect($Array_ConfigData['Mysql']['Host'], $Array_ConfigData['Mysql']['Username'], $Array_ConfigData['Mysql']['Password'], null, $Array_ConfigData['Mysql']['Port']);
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL查找库
|
||||
* @param string $Mysql_Query
|
||||
* @return string[] 查找到结果返回结果
|
||||
*/
|
||||
public static function SELECT(string $Mysql_Query): array
|
||||
{
|
||||
$CC_i = 0;
|
||||
$Result = null;
|
||||
$Array_OutPut = [];
|
||||
if (preg_match('/^SELECT/', $Mysql_Query)) {
|
||||
$Result = mysqli_query(self::MySqlConn(), $Mysql_Query);
|
||||
for (; $Result_Object = mysqli_fetch_object($Result); $CC_i++) {
|
||||
$Array_OutPut['output'] = 'Success';
|
||||
$Array_OutPut['data'][$CC_i] = $Result_Object;
|
||||
}
|
||||
if ($CC_i == 0)
|
||||
$Array_OutPut['output'] = 'EmptyResult';
|
||||
} else
|
||||
$Array_OutPut['output'] = 'TypeError';
|
||||
mysqli_free_result($Result);
|
||||
return $Array_OutPut;
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL插入库
|
||||
* @param string $Mysql_Query
|
||||
* @return bool
|
||||
*/
|
||||
public static function INSERT(string $Mysql_Query): bool
|
||||
{
|
||||
if (preg_match('/^INSERT/', $Mysql_Query))
|
||||
return mysqli_query(self::MySqlConn(), $Mysql_Query);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL更新库
|
||||
* @param string $Mysql_Query
|
||||
* @return bool
|
||||
*/
|
||||
public static function UPDATE(string $Mysql_Query): bool
|
||||
{
|
||||
if (preg_match('/^UPDATE/', $Mysql_Query))
|
||||
return mysqli_query(self::MySqlConn(), $Mysql_Query);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL删除库
|
||||
* @param string $Mysql_Query
|
||||
* @return bool
|
||||
*/
|
||||
public static function DELETE(string $Mysql_Query): bool
|
||||
{
|
||||
if (preg_match('/^DELETE/', $Mysql_Query))
|
||||
return mysqli_query(self::MySqlConn(), $Mysql_Query);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
118
class/Token.php
118
class/Token.php
|
@ -1,118 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
class Token
|
||||
{
|
||||
/** @var int|null Token生成长度 */
|
||||
public int $Data_TokenLong;
|
||||
/** @var string 生成的Token或获取的Token */
|
||||
public ?string $Data_Token = null;
|
||||
|
||||
/**
|
||||
* @param int|null $Token_Long 获取Token计算长度
|
||||
* @param bool $Token_Create 是否为 Token 创建模式
|
||||
*/
|
||||
public function __construct(int $Token_Long)
|
||||
{
|
||||
$this->Data_TokenLong = $Token_Long;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个新的 Token 值
|
||||
* 说明:
|
||||
*
|
||||
* 1. Token长度说明
|
||||
* - 在Token长度小于5时判断Token为错误类型,不允许生成Token(过于简单)
|
||||
* - 在Token长度大于等于5小于等于20时判断Token随机生成16进制随机数,若要进行判断,请使用SESSION或COKKIE进行自行编译判断
|
||||
* - 在Token长度大于20不大于等于40时创建带时间Token,进行判断可直接使用类中 examineToken 函数进行判断是否正确,请注意,依旧需要使用COOKIE进行存储Token
|
||||
* @return string Token检查错误返回对应错误代码,当Token正确生成输出结果为Token:xxx
|
||||
*/
|
||||
public function getToken(): string
|
||||
{
|
||||
$this->Data_Token = null;
|
||||
// 令牌合法化检测
|
||||
if ($this->checkToken() == "SUCCESS") {
|
||||
// Token设计
|
||||
if ($this->Data_TokenLong <= 20) {
|
||||
for ($CC_i = 0; $CC_i < $this->Data_TokenLong; $CC_i++) {
|
||||
$Data_RandNumber = dechex(rand(0, 15));
|
||||
$this->Data_Token .= $Data_RandNumber;
|
||||
}
|
||||
} else if ($this->Data_Token <= 40) {
|
||||
for ($CC_i = 0; $CC_i < 5; $CC_i++) {
|
||||
$Data_RandNumber = dechex(rand(0, 15));
|
||||
$this->Data_Token .= $Data_RandNumber;
|
||||
}
|
||||
$this->Data_Token .= (int)hexdec($this->Data_Token) % 7;
|
||||
$this->Data_Token .= (int)hexdec($this->Data_Token) % 2;
|
||||
$this->Data_Token .= date("ymdHi");
|
||||
$this->Data_Token .= (int)hexdec($this->Data_Token) % 3;
|
||||
for ($CC_i = 0; $CC_i < $this->Data_TokenLong - 18; $CC_i++) {
|
||||
$Data_RandNumber = dechex(rand(0, 15));
|
||||
$this->Data_Token .= $Data_RandNumber;
|
||||
}
|
||||
}
|
||||
// 结果输出
|
||||
return "Token:" . $this->Data_Token;
|
||||
} else
|
||||
return $this->checkToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* 令牌合法化检测(令牌检测需要必须大于5位数,否则视为违法令牌)
|
||||
* 返回值:
|
||||
*
|
||||
* - TokenTooShort [令牌太短]
|
||||
* - TokenTooLong [令牌太长]
|
||||
* - NotAvailable [非令牌获取模式]
|
||||
* @return string 返回上述结果
|
||||
*/
|
||||
private function checkToken(): string
|
||||
{
|
||||
if ($this->Data_TokenLong < 5)
|
||||
return "TokenTooShort";
|
||||
else if ($this->Data_TokenLong > 40)
|
||||
return "TokenTooLong";
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
/**
|
||||
* Token检查是否合法
|
||||
* 说明:
|
||||
*
|
||||
* 1. Token长度说明
|
||||
* - Token长度在小于5为过短,非正常Token
|
||||
* - Token长度在大于等于5小于等于20为输出随机16进制数字,此情况中此函数不予检测,请自行构建
|
||||
* - Token长度在大于20小于等于40为输出带时间Token,可直接使用此函数进行判断,合法Token并且通过验证返回SUCCESS
|
||||
* - Token长度大于40为非法Token
|
||||
* 2. 返回结果说明
|
||||
* - SUCCESS [验证通过]
|
||||
* - FAIL [检查不通过]
|
||||
* - NotAvailable [不支持此数据(也就是说你的Token长度为大于等于5小于等于20的情况下]
|
||||
* - TimeFail [验证超时]
|
||||
* @param string $Token Token检查,输入Token记录值,计算Token是否合法
|
||||
* @return string 如果检查通过输出SUCCESS,错误输出有多种
|
||||
*/
|
||||
public function examineToken(string $Token, int $Token_ExpDate): string
|
||||
{
|
||||
$this->Data_Token = $Token;
|
||||
// Token正规化检查
|
||||
if ($this->Data_TokenLong >= 5 && $this->Data_TokenLong <= 20)
|
||||
return "NotAvailable";
|
||||
else if ($this->Data_TokenLong <= 40) {
|
||||
if (hexdec(substr($this->Data_Token, 1, 5)) % 7 != substr($this->Data_Token, 6, 1))
|
||||
return "FAIL";
|
||||
if (hexdec(substr($this->Data_Token, 1, 6)) % 2 != substr($this->Data_Token, 7, 1))
|
||||
return "FAIL";
|
||||
if (strtotime(substr($this->Data_Token, 8, 10)) + $Token_ExpDate <= time())
|
||||
return "TimeFail";
|
||||
if (hexdec(substr($this->Data_Token, 1, 17)) % 3 == substr($this->Data_Token, 18, 1))
|
||||
return "FAIL";
|
||||
}
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
62
composer.json
Normal file
62
composer.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/sanctum": "^2.11",
|
||||
"laravel/tinker": "^2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
},
|
||||
"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
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
8330
composer.lock
generated
Normal file
8330
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
240
config/app.php
Normal file
240
config/app.php
Normal file
|
@ -0,0 +1,240 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => [
|
||||
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Arr' => Illuminate\Support\Arr::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'Date' => Illuminate\Support\Facades\Date::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Http' => Illuminate\Support\Facades\Http::class,
|
||||
'Js' => Illuminate\Support\Js::class,
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
// 'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||
'Request' => Illuminate\Support\Facades\Request::class,
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'Str' => Illuminate\Support\Str::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
116
config/auth.php
Normal file
116
config/auth.php
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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,
|
||||
|
||||
];
|
69
config/broadcasting.php
Normal file
69
config/broadcasting.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'useTLS' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
115
config/cache.php
Normal file
115
config/cache.php
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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 a RAM based store such as APC or Memcached, there might
|
||||
| be other applications utilizing the same cache. So, we'll specify a
|
||||
| value to get prefixed to all our keys so we can avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
|
||||
|
||||
];
|
39
config/cors.php
Normal file
39
config/cors.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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,
|
||||
|
||||
];
|
152
config/database.php
Normal file
152
config/database.php
Normal file
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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,
|
||||
'schema' => '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,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
78
config/filesystems.php
Normal file
78
config/filesystems.php
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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_DRIVER', '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 setup for each driver as an example of the required options.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
'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),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
],
|
||||
|
||||
];
|
57
config/hashing.php
Normal file
57
config/hashing.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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,
|
||||
],
|
||||
|
||||
];
|
123
config/logging.php
Normal file
123
config/logging.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => 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'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
123
config/mail.php
Normal file
123
config/mail.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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,
|
||||
'auth_mode' => null,
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -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'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
98
config/queue.php
Normal file
98
config/queue.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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',
|
||||
],
|
||||
|
||||
];
|
70
config/sanctum.php
Normal file
70
config/sanctum.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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',
|
||||
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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,
|
||||
],
|
||||
|
||||
];
|
38
config/services.php
Normal file
38
config/services.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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'),
|
||||
],
|
||||
|
||||
'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'),
|
||||
],
|
||||
|
||||
];
|
206
config/session.php
Normal file
206
config/session.php
Normal file
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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',
|
||||
|
||||
];
|
41
config/view.php
Normal file
41
config/view.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
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'))
|
||||
),
|
||||
|
||||
];
|
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'email' => $this->faker->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 \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
39
database/migrations/2023_06_11_050110_create_users_table.php
Normal file
39
database/migrations/2023_06_11_050110_create_users_table.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('username',40);
|
||||
$table->string('email',100)->unique();
|
||||
$table->string('password',255);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
37
database/migrations/2023_06_11_051939_update_users_table.php
Normal file
37
database/migrations/2023_06_11_051939_update_users_table.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->rememberToken();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSessionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->text('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
}
|
23
database/seeders/DatabaseSeeder.php
Normal file
23
database/seeders/DatabaseSeeder.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// \App\Models\User::factory(10)->create();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
# OutputMessage 标准对照表
|
||||
|
||||
| 序号 | output内容 | HTTP状态码 | 中文解释 |
|
||||
|-----|------------------|---------|------------------------------|
|
||||
| 100 | SessionError | 502 | 通讯密钥错误 |
|
||||
| 200 | Success | 200 | 操作成功 |
|
||||
| 201 | SuccessButEmail | 200 | 操作成功但邮件发送失败 |
|
||||
| 300 | SqlInsertFail | 400 | 数据表内容插入失败 |
|
||||
| 310 | TokenTooShort | 502 | Token长度过短 |
|
||||
| 311 | TokenTooLong | 502 | Token长度过长 |
|
||||
| 400 | usernameFormat | 405 | 用户名格式不符合 (格式允许0-9,A-Z,a-z及_) |
|
||||
| 401 | emailFormat | 405 | 邮箱格式不符合 |
|
||||
| 500 | CaptchaEffective | 200 | 激活码任然有效 |
|
||||
| 600 | AlReadyUser | 403 | 已经有这个用户 |
|
||||
| | | | |
|
||||
| | | | |
|
Binary file not shown.
Before Width: | Height: | Size: 290 KiB |
Binary file not shown.
9327
package-lock.json
generated
Normal file
9327
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
package.json
Normal file
24
package.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.14",
|
||||
"axios": "^0.21",
|
||||
"flowbite": "^1.6.5",
|
||||
"laravel-mix": "^6.0.6",
|
||||
"lodash": "^4.17.19",
|
||||
"postcss": "^8.4.24",
|
||||
"tailwindcss": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/forms": "^0.5.3"
|
||||
}
|
||||
}
|
37
phpunit.xml
Normal file
37
phpunit.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
~ 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
~ https://www.x-lf.com/
|
||||
-->
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<php>
|
||||
<server name="APP_ENV" value="testing"/>
|
||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||
<server name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
|
||||
<server name="MAIL_MAILER" value="array"/>
|
||||
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||
<server name="SESSION_DRIVER" value="array"/>
|
||||
<server name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
21
public/.htaccess
Normal file
21
public/.htaccess
Normal file
|
@ -0,0 +1,21 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,92 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var Array $Json_Data 最终数据编译输出
|
||||
* @var array $Array_ConfigData 配置文件
|
||||
*/
|
||||
|
||||
session_start();
|
||||
// 引入配置
|
||||
include dirname(__FILE__, 5) . "/Modules/API/header.php";
|
||||
require dirname(__FILE__, 5) . "/class/Sql.php";
|
||||
require dirname(__FILE__, 5) . "/class/Token.php";
|
||||
require dirname(__FILE__, 5) . "/class/Mailer/SendMail.php";
|
||||
require dirname(__FILE__, 5) . "/class/Normal.php";
|
||||
require dirname(__FILE__, 5) . "/class/Key.php";
|
||||
|
||||
// 类配置
|
||||
$ClassToken = new Token(40);
|
||||
$ClassMailer = new Mailer\SendMail();
|
||||
|
||||
// 数据获取类型
|
||||
$PostData = file_get_contents('php://input');
|
||||
$PostData = json_decode($PostData, true);
|
||||
|
||||
// 函数构建
|
||||
if ($Array_ConfigData['Session'] == $_SERVER['HTTP_SESSION']) {
|
||||
if (empty($_COOKIE['user'])) {
|
||||
// 检查数据
|
||||
if (preg_match('/^[0-9A-Za-z_]+$/', $PostData['username'])) {
|
||||
if (preg_match('/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/', $PostData['email'])) {
|
||||
// 密码加密
|
||||
$PostData['password'] = password_hash($PostData['password'], PASSWORD_DEFAULT);
|
||||
// 进行数据查找
|
||||
$AResult_User = Sql::SELECT("SELECT * FROM `index`.xf_user WHERE `username`='{$PostData['username']}' OR `email`='{$PostData['email']}'");
|
||||
if ($AResult_User['output'] == "EmptyResult") {
|
||||
// 创建用户
|
||||
if (Sql::INSERT("INSERT INTO `index`.xf_user (`username`,`email`,`password`,`reg_time`,`reg_ip`) VALUES ('{$PostData['username']}','{$PostData['email']}','{$PostData['password']}','" . time() . "','" . $_SERVER['REMOTE_ADDR'] . "')")) {
|
||||
// 生成激活码
|
||||
$Data_Captcha = Key::Captcha(100);
|
||||
$Data_NowTime = time();
|
||||
// 查找是否需要重新生成激活码
|
||||
$AResult_UserEmailVerify = Sql::SELECT("SELECT * FROM `index`.xf_email_verify WHERE `uid`={$PostData['username']} AND `time` >= $Data_NowTime-{$Array_ConfigData['Mail']['ExpDate']}");
|
||||
if ($AResult_UserEmailVerify['output'] == "EmptyResult") {
|
||||
// 创建激活码
|
||||
if (Sql::INSERT("INSERT INTO `index`.xf_email_verify (`uid`, `code`, `time`) VALUES ('{$PostData['username']}','$Data_Captcha','$Data_NowTime')")) {
|
||||
// 邮件发送
|
||||
if ($ClassMailer->PostMail($PostData['email'], 1, $Data_Captcha))
|
||||
Normal::Output(200);
|
||||
else Normal::Output(201);
|
||||
} else Normal::Output(300);
|
||||
} else Normal::Output(500);
|
||||
} else Normal::Output(300);
|
||||
} else Normal::Output(600);
|
||||
} else Normal::Output(401);
|
||||
} else Normal::Output(400);
|
||||
} else {
|
||||
// 数据库查找用户是否存在
|
||||
$AResult_User = Sql::SELECT("SELECT * FROM `index`.xf_user WHERE `uid`='{$_COOKIE['user']}'");
|
||||
if ($AResult_User['output'] == 'Success') {
|
||||
$Json_Data = [
|
||||
'output' => "AlReadyLogin",
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => "您已登录",
|
||||
],
|
||||
];
|
||||
} else if ($AResult_User['output'] == 'EmptyResult') {
|
||||
$Json_Data = [
|
||||
'output' => "IllegalLogin",
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => "非法登录",
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$Json_Data = [
|
||||
'output' => $AResult_User['output'],
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => "数据库搜索类型错误",
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Normal::Output(100);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var array $Json_Data 最终数据编译输出
|
||||
* @var array $Array_ConfigData 配置文件
|
||||
*/
|
||||
|
||||
// 引入配置
|
||||
include dirname(__FILE__, 5) . "/Modules/API/header.php";
|
||||
require dirname(__FILE__, 5) . "/class/Sql.php";
|
||||
require dirname(__FILE__, 5) . "/class/Normal.php";
|
||||
|
||||
// 数据获取类型
|
||||
$GetData = [
|
||||
'code' => urldecode(htmlspecialchars($_GET['code'])),
|
||||
];
|
||||
|
||||
// 函数构建
|
||||
if ($Array_ConfigData['Session'] == $_SERVER['HTTP_SESSION']) { /* 检查通讯密钥是否正确 */
|
||||
if (!empty($_COOKIE['user'])) {
|
||||
|
||||
} else {
|
||||
$Json_Data = [
|
||||
'output' => 'NoLogin',
|
||||
'code' => 502,
|
||||
'data' => [
|
||||
'message' => '需要登陆',
|
||||
],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
// 编译输出
|
||||
Normal::Output(100);
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var Array $Json_Data 最终数据编译输出
|
||||
*/
|
||||
|
||||
// 类引入
|
||||
require dirname(__FILE__, 5) . "/class/Token.php";
|
||||
// 类构建
|
||||
$ClassToken = new Token(40, true);
|
||||
|
||||
// 函数构建
|
||||
if (empty($_COOKIE['Token'])) {
|
||||
if (preg_match('/^Token:/', $ClassToken->getToken())) {
|
||||
// 不匹配Token
|
||||
$Data_Token = substr($ClassToken->getToken(), 6);
|
||||
// 生成Token
|
||||
$Json_Data = [
|
||||
'output' => 'Success',
|
||||
'code' => 200,
|
||||
'data' => [
|
||||
'message' => '生成完毕',
|
||||
'token' => $Data_Token,
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$Json_Data = [
|
||||
'output' => $ClassToken->getToken(),
|
||||
'code' => 502,
|
||||
'data' => [
|
||||
'message' => '按需检查对应错误',
|
||||
],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$Json_Data = [
|
||||
'output' => 'TokenNotEmpty',
|
||||
'code' => 403,
|
||||
'data' => [
|
||||
'message' => "Token不为空",
|
||||
],
|
||||
];
|
||||
}
|
||||
// 输出JSON
|
||||
echo json_encode($Json_Data, JSON_UNESCAPED_UNICODE);
|
2113
public/css/app.css
Normal file
2113
public/css/app.css
Normal file
File diff suppressed because it is too large
Load Diff
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
|
@ -4,3 +4,57 @@
|
|||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Check If The Application Is Under Maintenance
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If the application is in maintenance / demo mode via the "down" command
|
||||
| we will load this file so that any pre-rendered content can be shown
|
||||
| instead of starting the framework, which could cause an exception.
|
||||
|
|
||||
*/
|
||||
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader for
|
||||
| this application. We just need to utilize it! We'll simply require it
|
||||
| into the script here so we don't need to manually load our classes.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request using
|
||||
| the application's HTTP kernel. Then, we will send the response back
|
||||
| to this client's browser, allowing them to enjoy our application.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
$response = $kernel->handle(
|
||||
$request = Request::capture()
|
||||
)->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
|
|
25367
public/js/app.js
Normal file
25367
public/js/app.js
Normal file
File diff suppressed because it is too large
Load Diff
10985
public/js/jquery.js
vendored
Normal file
10985
public/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
public/js/jquery.min.js
vendored
Normal file
8
public/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
public/js/jquery.min.map
Normal file
7
public/js/jquery.min.map
Normal file
File diff suppressed because one or more lines are too long
4
public/mix-manifest.json
Normal file
4
public/mix-manifest.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"/js/app.js": "/js/app.js",
|
||||
"/css/app.css": "/css/app.css"
|
||||
}
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow:
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
|
||||
require('./bootstrap');
|
||||
import 'flowbite';
|
34
resources/js/bootstrap.js
vendored
Normal file
34
resources/js/bootstrap.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
window._ = require('lodash');
|
||||
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
window.axios = require('axios');
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
||||
/**
|
||||
* Echo exposes an expressive API for subscribing to channels and listening
|
||||
* for events that are broadcast by Laravel. Echo and event broadcasting
|
||||
* allows your team to easily build robust real-time web applications.
|
||||
*/
|
||||
|
||||
// import Echo from 'laravel-echo';
|
||||
|
||||
// window.Pusher = require('pusher-js');
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: process.env.MIX_PUSHER_APP_KEY,
|
||||
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
||||
// forceTLS: true
|
||||
// });
|
10985
resources/js/jquery.js
vendored
Normal file
10985
resources/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
resources/js/jquery.min.map
Normal file
7
resources/js/jquery.min.map
Normal file
File diff suppressed because one or more lines are too long
25
resources/lang/en/auth.php
Normal file
25
resources/lang/en/auth.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used during authentication for various
|
||||
| messages that we need to display to the user. You are free to modify
|
||||
| these language lines according to your application's requirements.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'password' => 'The provided password is incorrect.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
|
||||
];
|
24
resources/lang/en/pagination.php
Normal file
24
resources/lang/en/pagination.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used by the paginator library to build
|
||||
| the simple pagination links. You are free to change them to anything
|
||||
| you want to customize your views to better match your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'previous' => '« Previous',
|
||||
'next' => 'Next »',
|
||||
|
||||
];
|
27
resources/lang/en/passwords.php
Normal file
27
resources/lang/en/passwords.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are the default lines which match reasons
|
||||
| that are given by the password broker for a password update attempt
|
||||
| has failed, such as for an invalid token or invalid new password.
|
||||
|
|
||||
*/
|
||||
|
||||
'reset' => 'Your password has been reset!',
|
||||
'sent' => 'We have emailed your password reset link!',
|
||||
'throttled' => 'Please wait before retrying.',
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'user' => "We can't find a user with that email address.",
|
||||
|
||||
];
|
168
resources/lang/en/validation.php
Normal file
168
resources/lang/en/validation.php
Normal file
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute must only contain letters.',
|
||||
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
|
||||
'alpha_num' => 'The :attribute must only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'current_password' => 'The password is incorrect.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_equals' => 'The :attribute must be a date equal to :date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'declined' => 'The :attribute must be declined.',
|
||||
'declined_if' => 'The :attribute must be declined when :other is :value.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
||||
'enum' => 'The selected :attribute is invalid.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
'numeric' => 'The :attribute must be greater than :value.',
|
||||
'file' => 'The :attribute must be greater than :value kilobytes.',
|
||||
'string' => 'The :attribute must be greater than :value characters.',
|
||||
'array' => 'The :attribute must have more than :value items.',
|
||||
],
|
||||
'gte' => [
|
||||
'numeric' => 'The :attribute must be greater than or equal to :value.',
|
||||
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
|
||||
'string' => 'The :attribute must be greater than or equal to :value characters.',
|
||||
'array' => 'The :attribute must have :value items or more.',
|
||||
],
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'lt' => [
|
||||
'numeric' => 'The :attribute must be less than :value.',
|
||||
'file' => 'The :attribute must be less than :value kilobytes.',
|
||||
'string' => 'The :attribute must be less than :value characters.',
|
||||
'array' => 'The :attribute must have less than :value items.',
|
||||
],
|
||||
'lte' => [
|
||||
'numeric' => 'The :attribute must be less than or equal to :value.',
|
||||
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
|
||||
'string' => 'The :attribute must be less than or equal to :value characters.',
|
||||
'array' => 'The :attribute must not have more than :value items.',
|
||||
],
|
||||
'mac_address' => 'The :attribute must be a valid MAC address.',
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute must not be greater than :max.',
|
||||
'file' => 'The :attribute must not be greater than :max kilobytes.',
|
||||
'string' => 'The :attribute must not be greater than :max characters.',
|
||||
'array' => 'The :attribute must not have more than :max items.',
|
||||
],
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
],
|
||||
'multiple_of' => 'The :attribute must be a multiple of :value.',
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_regex' => 'The :attribute format is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'password' => 'The password is incorrect.',
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'prohibited' => 'The :attribute field is prohibited.',
|
||||
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
],
|
||||
'starts_with' => 'The :attribute must start with one of the following: :values.',
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid timezone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute must be a valid URL.',
|
||||
'uuid' => 'The :attribute must be a valid UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
1
resources/views/auth/forgotpassword.blade.php
Normal file
1
resources/views/auth/forgotpassword.blade.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php
|
81
resources/views/auth/login.blade.php
Normal file
81
resources/views/auth/login.blade.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-CN" class="h-full bg-white">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
|
||||
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
|
||||
<img class="mx-auto h-10 w-auto" src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600"
|
||||
alt="Your Company">
|
||||
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">登录您的账号</h2>
|
||||
</div>
|
||||
|
||||
<div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
|
||||
<form class="space-y-6" id="FormData" action="#" onsubmit="return false" method="POST">
|
||||
@csrf
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium leading-6 text-gray-900">邮箱地址/用户名</label>
|
||||
<div class="mt-2">
|
||||
<input id="email" name="email" type="email" autocomplete="email" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="flex items-center justify-between">
|
||||
<label for="password" class="block text-sm font-medium leading-6 text-gray-900">密码</label>
|
||||
<div class="text-sm">
|
||||
<a href="{{ route('forgotpassword') }}"
|
||||
class="font-semibold text-indigo-600 hover:text-indigo-500">忘记密码?</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<input id="password" name="password" type="password" autocomplete="current-password" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="submit"
|
||||
class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||
onclick="user_change()">
|
||||
登录
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="mt-10 text-center text-sm text-gray-500">
|
||||
还没有账号?
|
||||
<a href="{{ route('register') }}"
|
||||
class="font-semibold leading-6 text-indigo-600 hover:text-indigo-500">点击注册</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/jquery.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function user_change() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
method: "POST",
|
||||
data: $('#FormData').serialize(),
|
||||
url: '{{ route('api.auth.login') }}',
|
||||
dataType: "json",
|
||||
success: function (returnData) {
|
||||
if (returnData.output === "Success") {
|
||||
window.location.href = '{{ route('console.dashboard') }}'
|
||||
} else {
|
||||
window.alert("错误!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</html>
|
96
resources/views/auth/register.blade.php
Normal file
96
resources/views/auth/register.blade.php
Normal file
|
@ -0,0 +1,96 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-CN" class="h-full bg-white">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
|
||||
<div class="sm:mx-auto sm:w-full sm:max-w-sm">
|
||||
<img class="mx-auto h-10 w-auto" src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600"
|
||||
alt="Your Company">
|
||||
<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">注册您的账号</h2>
|
||||
</div>
|
||||
|
||||
<div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm">
|
||||
<form class="space-y-6" id="FormData" action="#" onsubmit="return false" method="POST">
|
||||
@csrf
|
||||
<div>
|
||||
<label for="username" class="block text-sm font-medium leading-6 text-gray-900">用户名</label>
|
||||
<div class="mt-2">
|
||||
<input id="username" name="username" type="text" autocomplete="username" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium leading-6 text-gray-900">邮箱地址</label>
|
||||
<div class="mt-2">
|
||||
<input id="email" name="email" type="email" autocomplete="email" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="flex items-center justify-between">
|
||||
<label for="password" class="block text-sm font-medium leading-6 text-gray-900">密码</label>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<input id="password" name="password" type="password" autocomplete="current-password" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="flex items-center justify-between">
|
||||
<label for="password" class="block text-sm font-medium leading-6 text-gray-900">重复密码</label>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<input id="password_confirmation" name="password_confirmation" type="password"
|
||||
autocomplete="current-password" required
|
||||
class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button type="submit"
|
||||
class="flex w-full justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||
onclick="user_change()">
|
||||
注册
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="mt-10 text-center text-sm text-gray-500">
|
||||
已经有账号了?
|
||||
<a href="{{ route('login') }}" class="font-semibold leading-6 text-indigo-600 hover:text-indigo-500">
|
||||
点击登录!</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/jquery.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function user_change() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
method: "POST",
|
||||
data: $('#FormData').serialize(),
|
||||
url: '{{ route('api.auth.register') }}',
|
||||
dataType: "json",
|
||||
success: function (returnData) {
|
||||
if (returnData.output === "Success") {
|
||||
window.location.href = '{{ route('console.dashboard') }}'
|
||||
} else {
|
||||
window.alert("错误!")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</html>
|
214
resources/views/console/dashboard.blade.php
Normal file
214
resources/views/console/dashboard.blade.php
Normal file
|
@ -0,0 +1,214 @@
|
|||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<button data-drawer-target="sidebar-multi-level-sidebar" data-drawer-toggle="sidebar-multi-level-sidebar"
|
||||
aria-controls="sidebar-multi-level-sidebar" type="button"
|
||||
class="inline-flex items-center p-2 mt-2 ml-3 text-sm text-gray-500 rounded-lg sm:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600">
|
||||
<span class="sr-only">Open sidebar</span>
|
||||
<svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path clip-rule="evenodd" fill-rule="evenodd"
|
||||
d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<aside id="sidebar-multi-level-sidebar"
|
||||
class="fixed top-0 left-0 z-40 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0"
|
||||
aria-label="Sidebar">
|
||||
<div class="h-full px-3 py-4 overflow-y-auto bg-gray-50 dark:bg-gray-800">
|
||||
<ul class="space-y-2 font-medium">
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path>
|
||||
<path d="M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"></path>
|
||||
</svg>
|
||||
<span class="ml-3">Dashboard</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button"
|
||||
class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
|
||||
aria-controls="dropdown-example" data-collapse-toggle="dropdown-example">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 group-hover:text-gray-900 dark:text-gray-400 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 0zm7-1a1 1 0 100 2 1 1 0 000-2z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 text-left whitespace-nowrap" sidebar-toggle-item>E-commerce</span>
|
||||
<svg sidebar-toggle-item class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<ul id="dropdown-example" class="hidden py-2 space-y-2">
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Products</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Billing</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Invoice</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Kanban</span>
|
||||
<span
|
||||
class="inline-flex items-center justify-center px-2 ml-3 text-sm font-medium text-gray-800 bg-gray-200 rounded-full dark:bg-gray-700 dark:text-gray-300">Pro</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M8.707 7.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l2-2a1 1 0 00-1.414-1.414L11 7.586V3a1 1 0 10-2 0v4.586l-.293-.293z"></path>
|
||||
<path
|
||||
d="M3 5a2 2 0 012-2h1a1 1 0 010 2H5v7h2l1 2h4l1-2h2V5h-1a1 1 0 110-2h1a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Inbox</span>
|
||||
<span
|
||||
class="inline-flex items-center justify-center w-3 h-3 p-3 ml-3 text-sm font-medium text-blue-800 bg-blue-100 rounded-full dark:bg-blue-900 dark:text-blue-300">3</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Users</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 0zm7-1a1 1 0 100 2 1 1 0 000-2z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Products</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M3 3a1 1 0 00-1 1v12a1 1 0 102 0V4a1 1 0 00-1-1zm10.293 9.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L14.586 9H7a1 1 0 100 2h7.586l-1.293 1.293z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Sign In</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<svg aria-hidden="true"
|
||||
class="flex-shrink-0 w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"
|
||||
fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M5 4a3 3 0 00-3 3v6a3 3 0 003 3h10a3 3 0 003-3V7a3 3 0 00-3-3H5zm-1 9v-1h5v2H5a1 1 0 01-1-1zm7 1h4a1 1 0 001-1v-1h-5v2zm0-4h5V8h-5v2zM9 8H4v2h5V8z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="flex-1 ml-3 whitespace-nowrap">Sign Up</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="p-4 sm:ml-64">
|
||||
<div class="p-4 border-2 border-gray-200 border-dashed rounded-lg dark:border-gray-700">
|
||||
<div class="grid grid-cols-3 gap-4 mb-4">
|
||||
<div class="flex items-center justify-center h-24 rounded bg-gray-50 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center h-24 rounded bg-gray-50 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center h-24 rounded bg-gray-50 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center h-48 mb-4 rounded bg-gray-50 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4 mb-4">
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-center h-48 mb-4 rounded bg-gray-50 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
<div class="flex items-center justify-center rounded bg-gray-50 h-28 dark:bg-gray-800">
|
||||
<p class="text-2xl text-gray-400 dark:text-gray-500">+</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<script src="{{ asset('js/flowbite.js') }}"></script>
|
||||
<script src="{{ asset('js/jquery.js') }}"></script>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user