mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
commit message
This commit is contained in:
commit
b2cd17b82f
15
.editorconfig
Executable file
15
.editorconfig
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
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
|
52
.env.example
Executable file
52
.env.example
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
APP_NAME=V2Board
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
|
||||||
|
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
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_DRIVER=smtp
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS=null
|
||||||
|
MAIL_FROM_NAME=null
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
||||||
|
DEFAULT_INVITE_FORCE=0
|
||||||
|
DEFAULT_INVITE_COMMISSION=10
|
||||||
|
DEFAULT_INVITE_GEN_LIMIT=5
|
||||||
|
DEFAULT_STOP_REGISTER=0
|
||||||
|
DEFAULT_EMAIL_VERIFY=0
|
5
.gitattributes
vendored
Executable file
5
.gitattributes
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
* text=auto
|
||||||
|
*.css linguist-vendored
|
||||||
|
*.scss linguist-vendored
|
||||||
|
*.js linguist-vendored
|
||||||
|
CHANGELOG.md export-ignore
|
16
.gitignore
vendored
Executable file
16
.gitignore
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
/node_modules
|
||||||
|
/config/v2panel.php
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/vendor
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.phpunit.result.cache
|
||||||
|
.idea
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
composer.phar
|
||||||
|
yarn.lock
|
16
.styleci.yml
Executable file
16
.styleci.yml
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
php:
|
||||||
|
preset: laravel
|
||||||
|
enabled:
|
||||||
|
- alpha_ordered_imports
|
||||||
|
disabled:
|
||||||
|
- length_ordered_imports
|
||||||
|
- unused_use
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- index.php
|
||||||
|
- server.php
|
||||||
|
js:
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- webpack.mix.js
|
||||||
|
css: true
|
58
app/Console/Commands/CheckCommission.php
Normal file
58
app/Console/Commands/CheckCommission.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class CheckCommission extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'check:commission';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '返佣服务';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$order = Order::where('commission_status', 0)
|
||||||
|
->where('status', 3)
|
||||||
|
->get();
|
||||||
|
foreach ($order as $item) {
|
||||||
|
if ($order->invite_user_id) {
|
||||||
|
$inviter = User::find($order->invite_user_id);
|
||||||
|
if (!$inviter) continue;
|
||||||
|
$inviter->commission_balance = $inviter->commission_balance + $order->commission_balance;
|
||||||
|
if ($inviter->save()) {
|
||||||
|
$item->commission_status = 1;
|
||||||
|
$item->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
53
app/Console/Commands/CheckExpire.php
Normal file
53
app/Console/Commands/CheckExpire.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class CheckExpire extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'check:expire';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '过期检查';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$user = User::all();
|
||||||
|
foreach ($user as $item) {
|
||||||
|
if ($user->expired_at < time()) {
|
||||||
|
$user->enable = 0;
|
||||||
|
} else {
|
||||||
|
$user->enable = 1;
|
||||||
|
}
|
||||||
|
$item->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
92
app/Console/Commands/CheckOrder.php
Executable file
92
app/Console/Commands/CheckOrder.php
Executable file
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Utils\Helper;
|
||||||
|
|
||||||
|
class CheckOrder extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'check:order';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = '订单检查任务';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$order = Order::get();
|
||||||
|
foreach ($order as $item) {
|
||||||
|
switch ($item->status) {
|
||||||
|
case 0:
|
||||||
|
if (strtotime($item->created_at) <= (time() - 1800)) {
|
||||||
|
$item->status = 2;
|
||||||
|
$item->save();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$this->orderHandle($item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function orderHandle ($order) {
|
||||||
|
$user = User::find($order->user_id);
|
||||||
|
if (!$user->plan_id || $order->plan_id == $user->plan_id) {
|
||||||
|
return $this->buy($order, $user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buy ($order, $user) {
|
||||||
|
$plan = Plan::find($order->plan_id);
|
||||||
|
$user->transfer_enable = $plan->transfer_enable * 1073741824;
|
||||||
|
$user->enable = 1;
|
||||||
|
$user->plan_id = $plan->id;
|
||||||
|
$user->group_id = $plan->group_id;
|
||||||
|
$user->expired_at = $this->getTime($order->cycle, $user->expired_at);
|
||||||
|
if ($user->save()) {
|
||||||
|
$order->status = 3;
|
||||||
|
$order->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getTime ($str, $timestamp) {
|
||||||
|
if ($timestamp < time()) {
|
||||||
|
$timestamp = time();
|
||||||
|
}
|
||||||
|
switch ($str) {
|
||||||
|
case 'month_price': return strtotime('+1 month', $timestamp);
|
||||||
|
case 'quarter_price': return strtotime('+3 month', $timestamp);
|
||||||
|
case 'quarter_price': return strtotime('+6 month', $timestamp);
|
||||||
|
case 'quarter_price': return strtotime('+12 month', $timestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
app/Console/Kernel.php
Executable file
45
app/Console/Kernel.php
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Artisan commands provided by your application.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $commands = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the application's command schedule.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function schedule(Schedule $schedule)
|
||||||
|
{
|
||||||
|
$schedule->command('check:order')->everyMinute();
|
||||||
|
$schedule->command('check:expire')->everyMinute();
|
||||||
|
$schedule->command('check:commission')->daily();
|
||||||
|
// $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');
|
||||||
|
}
|
||||||
|
}
|
52
app/Exceptions/Handler.php
Executable file
52
app/Exceptions/Handler.php
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A list of the exception types that are not reported.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $dontReport = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $dontFlash = [
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report or log an exception.
|
||||||
|
*
|
||||||
|
* @param \Exception $exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function report(Exception $exception)
|
||||||
|
{
|
||||||
|
parent::report($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render an exception into an HTTP response.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Exception $exception
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function render($request, Exception $exception)
|
||||||
|
{
|
||||||
|
return parent::render($request, $exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
70
app/Http/Controllers/Admin/ConfigController.php
Executable file
70
app/Http/Controllers/Admin/ConfigController.php
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Requests\Admin\ConfigSave;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class ConfigController extends Controller
|
||||||
|
{
|
||||||
|
public function init () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index () {
|
||||||
|
return response([
|
||||||
|
'data' => [
|
||||||
|
'invite' => [
|
||||||
|
'invite_force' => (int)config('v2board.invite_force', env('DEFAULT_INVITE_FORCE')),
|
||||||
|
'invite_commission' => config('v2board.invite_commission', env('DEFAULT_INVITE_COMMISSION')),
|
||||||
|
'invite_gen_limit' => config('v2board.invite_gen_limit', env('DEFAULT_INVITE_GEN_LIMIT'))
|
||||||
|
],
|
||||||
|
'site' => [
|
||||||
|
'stop_register' => (int)config('v2board.stop_register', env('DEFAULT_STOP_REGISTER')),
|
||||||
|
'email_verify' => (int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY')),
|
||||||
|
'app_name' => config('v2board.app_name', env('APP_NAME')),
|
||||||
|
'app_url' => config('v2board.app_url', env('APP_URL'))
|
||||||
|
],
|
||||||
|
'pay' => [
|
||||||
|
// alipay
|
||||||
|
'alipay_enable' => (int)config('v2board.alipay_enable'),
|
||||||
|
'alipay_appid' => config('v2board.alipay_appid'),
|
||||||
|
'alipay_pubkey' => config('v2board.alipay_pubkey'),
|
||||||
|
'alipay_privkey' => config('v2board.alipay_privkey'),
|
||||||
|
// stripe
|
||||||
|
'stripe_sk_live' => config('v2board.stripe_sk_live'),
|
||||||
|
'stripe_pk_live' => config('v2board.stripe_pk_live'),
|
||||||
|
'stripe_alipay_enable' => (int)config('v2board.stripe_alipay_enable'),
|
||||||
|
'stripe_wepay_enable' => (int)config('v2board.stripe_wepay_enable'),
|
||||||
|
'stripe_webhook_key' => config('v2board.stripe_webhook_key')
|
||||||
|
],
|
||||||
|
'server' => [
|
||||||
|
'server_token' => config('v2board.server_token')
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save (ConfigSave $request) {
|
||||||
|
$data = $request->input();
|
||||||
|
$array = \Config::get('v2board');
|
||||||
|
foreach ($data as $k => $v) {
|
||||||
|
if (!in_array($k, ConfigSave::filter())) {
|
||||||
|
abort(500, '禁止修改');
|
||||||
|
}
|
||||||
|
$array[$k] = $v;
|
||||||
|
}
|
||||||
|
$data = var_export($array, 1);
|
||||||
|
if(!\File::put(base_path() . '/config/v2board.php', "<?php\n return $data ;")) {
|
||||||
|
abort(500, '修改失败');
|
||||||
|
}
|
||||||
|
\Artisan::call('config:cache');
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
45
app/Http/Controllers/Admin/OrderController.php
Normal file
45
app/Http/Controllers/Admin/OrderController.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class OrderController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
|
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||||
|
$orderModel = Order::orderBy('created_at', 'DESC');
|
||||||
|
if ($request->input('trade_no')) {
|
||||||
|
$orderModel->where('trade_no', $request->input('trade_no'));
|
||||||
|
}
|
||||||
|
$total = $orderModel->count();
|
||||||
|
return response([
|
||||||
|
'data' => $orderModel->forPage($current, $pageSize)
|
||||||
|
->get(),
|
||||||
|
'total' => $total
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function repair (Request $request) {
|
||||||
|
if (empty($request->input('trade_no'))) {
|
||||||
|
abort(500, '参数错误');
|
||||||
|
}
|
||||||
|
$order = Order::where('trade_no', $request->input('trade_no'))
|
||||||
|
->where('status', 0)
|
||||||
|
->first();
|
||||||
|
if (!$order) {
|
||||||
|
abort(500, '订单不存在或订单已支付');
|
||||||
|
}
|
||||||
|
$order->status = 1;
|
||||||
|
if (!$order->save()) {
|
||||||
|
abort(500, '保存失败');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
85
app/Http/Controllers/Admin/PlanController.php
Executable file
85
app/Http/Controllers/Admin/PlanController.php
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Requests\Admin\PlanSave;
|
||||||
|
use App\Http\Requests\Admin\PlanUpdate;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class PlanController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
return response([
|
||||||
|
'data' => Plan::get()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save (PlanSave $request) {
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$plan = Plan::find($request->input('id'));
|
||||||
|
if (!$plan) {
|
||||||
|
abort(500, '该订阅不存在');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$plan = new Plan();
|
||||||
|
}
|
||||||
|
$plan->name = $request->input('name');
|
||||||
|
$plan->content = $request->input('content');
|
||||||
|
if ($plan->content) {
|
||||||
|
$plan->content = str_replace(PHP_EOL, '', $plan->content);
|
||||||
|
}
|
||||||
|
$plan->show = $request->input('show');
|
||||||
|
$plan->renew = $request->input('renew');
|
||||||
|
$plan->transfer_enable = $request->input('transfer_enable');
|
||||||
|
$plan->group_id = $request->input('group_id');
|
||||||
|
$plan->month_price = $request->input('month_price');
|
||||||
|
$plan->quarter_price = $request->input('quarter_price');
|
||||||
|
$plan->half_year_price = $request->input('half_year_price');
|
||||||
|
$plan->year_price = $request->input('year_price');
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'data' => $plan->save()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function drop (Request $request) {
|
||||||
|
if (Order::where('plan_id', $request->input('id'))->first()) {
|
||||||
|
abort(500, '该订阅下存在订单无法删除');
|
||||||
|
}
|
||||||
|
if (User::where('plan_id', $request->input('id'))->first()) {
|
||||||
|
abort(500, '该订阅下存在用户无法删除');
|
||||||
|
}
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$plan = Plan::find($request->input('id'));
|
||||||
|
if (!$plan) {
|
||||||
|
abort(500, '该订阅ID不存在');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $plan->delete()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update (PlanUpdate $request) {
|
||||||
|
$updateData = $request->only([
|
||||||
|
'show',
|
||||||
|
'renew'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$plan = Plan::find($request->input('id'));
|
||||||
|
if (!$plan) {
|
||||||
|
abort(500, '该订阅不存在');
|
||||||
|
}
|
||||||
|
if (!$plan->update($updateData)) {
|
||||||
|
abort(500, '保存失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
109
app/Http/Controllers/Admin/ServerController.php
Executable file
109
app/Http/Controllers/Admin/ServerController.php
Executable file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Requests\Admin\ServerSave;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\ServerGroup;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class ServerController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
return response([
|
||||||
|
'data' => Server::get()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save (ServerSave $request) {
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$server = Server::find($request->input('id'));
|
||||||
|
if (!$server) {
|
||||||
|
abort(500, '服务器不存在');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$server = new Server();
|
||||||
|
}
|
||||||
|
$server->group_id = json_encode($request->input('group_id'));
|
||||||
|
$server->name = $request->input('name');
|
||||||
|
$server->host = $request->input('host');
|
||||||
|
$server->port = $request->input('port');
|
||||||
|
$server->server_port = $request->input('server_port');
|
||||||
|
$server->tls = $request->input('tls');
|
||||||
|
$server->tags = json_encode($request->input('tags'));
|
||||||
|
$server->rate = $request->input('rate');
|
||||||
|
return response([
|
||||||
|
'data' => $server->save()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function group (Request $request) {
|
||||||
|
if ($request->input('group_id')) {
|
||||||
|
return response([
|
||||||
|
'data' => [ServerGroup::find($request->input('group_id'))]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => ServerGroup::get()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function groupSave (Request $request) {
|
||||||
|
if (empty($request->input('name'))) {
|
||||||
|
abort(500, '组名不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$serverGroup = ServerGroup::find($request->input('id'));
|
||||||
|
} else {
|
||||||
|
$serverGroup = new ServerGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
$serverGroup->name = $request->input('name');
|
||||||
|
return response([
|
||||||
|
'data' => $serverGroup->save()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function groupDrop (Request $request) {
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$serverGroup = ServerGroup::find($request->input('id'));
|
||||||
|
if (!$serverGroup) {
|
||||||
|
abort(500, '组不存在');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$servers = Server::all();
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
$groupId = json_decode($server->group_id);
|
||||||
|
if (in_array($request->input('id'), $groupId)) {
|
||||||
|
abort(500, '该组已被节点所使用,无法删除');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Plan::where('group_id', $request->input('id'))->first()) {
|
||||||
|
abort(500, '该组已被订阅所使用,无法删除');
|
||||||
|
}
|
||||||
|
if (User::where('group_id', $request->input('id'))->first()) {
|
||||||
|
abort(500, '该组已被用户所使用,无法删除');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $serverGroup->delete()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function drop (Request $request) {
|
||||||
|
if ($request->input('id')) {
|
||||||
|
$server = Server::find($request->input('id'));
|
||||||
|
if (!$server) {
|
||||||
|
abort(500, '节点ID不存在');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $server->delete()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
57
app/Http/Controllers/Admin/UserController.php
Normal file
57
app/Http/Controllers/Admin/UserController.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Requests\Admin\UserUpdate;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
|
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||||
|
$userModel = User::orderBy('created_at', 'DESC');
|
||||||
|
if ($request->input('email')) {
|
||||||
|
$userModel->where('email', $request->input('email'));
|
||||||
|
}
|
||||||
|
$total = $userModel->count();
|
||||||
|
return response([
|
||||||
|
'data' => $userModel->forPage($current, $pageSize)
|
||||||
|
->get(),
|
||||||
|
'total' => $total
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update (UserUpdate $request) {
|
||||||
|
$updateData = $request->only([
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
'transfer_enable',
|
||||||
|
'expired_at',
|
||||||
|
'banned',
|
||||||
|
'is_admin'
|
||||||
|
]);
|
||||||
|
$user = User::find($request->input('id'));
|
||||||
|
if (!$user) {
|
||||||
|
abort(500, '用户不存在');
|
||||||
|
}
|
||||||
|
if (User::where('email', $updateData['email'])->first() && $user->email !== $updateData['email']) {
|
||||||
|
abort(500, '邮箱已被使用');
|
||||||
|
}
|
||||||
|
if ($updateData['password']) {
|
||||||
|
$updateData['password'] = password_hash($updateData['password'], PASSWORD_DEFAULT);
|
||||||
|
} else {
|
||||||
|
unset($updateData['password']);
|
||||||
|
}
|
||||||
|
$updateData['transfer_enable'] = $updateData['transfer_enable'] * 1073741824;
|
||||||
|
if (!$user->update($updateData)) {
|
||||||
|
abort(500, '保存失败');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
121
app/Http/Controllers/ClientController.php
Executable file
121
app/Http/Controllers/ClientController.php
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\Server;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
class ClientController extends Controller
|
||||||
|
{
|
||||||
|
public function subscribe (Request $request) {
|
||||||
|
$user = $request->user;
|
||||||
|
$server = [];
|
||||||
|
if ($user->expired_at > time()) {
|
||||||
|
$servers = Server::all();
|
||||||
|
foreach ($servers as $item) {
|
||||||
|
$groupId = json_decode($item['group_id']);
|
||||||
|
if (in_array($user->group_id, $groupId)) {
|
||||||
|
array_push($server, $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult%20X') !== false) {
|
||||||
|
die($this->quantumultX($user, $server));
|
||||||
|
}
|
||||||
|
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Quantumult') !== false) {
|
||||||
|
die($this->quantumult($user, $server));
|
||||||
|
}
|
||||||
|
if(strpos($_SERVER['HTTP_USER_AGENT'], 'clash_win') !== false) {
|
||||||
|
die($this->clash($user, $server));
|
||||||
|
}
|
||||||
|
die($this->origin($user, $server));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function quantumultX ($user, $server) {
|
||||||
|
$uri = '';
|
||||||
|
foreach($server as $item) {
|
||||||
|
$uri .= "vmess=".$item->host.":".$item->port.", method=none, password=".$user->v2ray_uuid.", over-tls=".($item->tls?'true':'false').", certificate=0, fast-open=false, udp-relay=false, tag=".$item->name."\r\n";
|
||||||
|
}
|
||||||
|
return base64_encode($uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function quantumult ($user, $server) {
|
||||||
|
$uri = '';
|
||||||
|
header('subscription-userinfo: upload='.$user->u.'; download='.$user->d.';total='.$user->transfer_enable);
|
||||||
|
foreach($server as $item) {
|
||||||
|
$uri .= "vmess://".base64_encode($item->name.'= vmess, '.$item->host.', '.$item->port.', chacha20-ietf-poly1305, "'.$user->v2ray_uuid.'", over-tls='.($item->tls?"true":"false").', certificate=0, group='.config('v2board.app_name', 'V2Board'))."\r\n";
|
||||||
|
}
|
||||||
|
return base64_encode($uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function origin ($user, $server) {
|
||||||
|
$uri = '';
|
||||||
|
foreach($server as $item) {
|
||||||
|
$config = [
|
||||||
|
"ps" => $item->name,
|
||||||
|
"add" => $item->host,
|
||||||
|
"port" => $item->port,
|
||||||
|
"id" => $user->v2ray_uuid,
|
||||||
|
"aid" => "2",
|
||||||
|
"net" => "tcp",
|
||||||
|
"type" => "chacha20-poly1305",
|
||||||
|
"host" => "",
|
||||||
|
"tls" => $item->tls?"tls":"",
|
||||||
|
];
|
||||||
|
$uri .= "vmess://".base64_encode(json_encode($config))."\r\n";
|
||||||
|
}
|
||||||
|
return base64_encode($uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function clash ($user, $server) {
|
||||||
|
$proxy = [];
|
||||||
|
$proxyGroup = [];
|
||||||
|
$proxies = [];
|
||||||
|
foreach ($server as $item) {
|
||||||
|
$array = [];
|
||||||
|
$array['name'] = $item->name;
|
||||||
|
$array['type'] = 'vmess';
|
||||||
|
$array['server'] = $item->host;
|
||||||
|
$array['port'] = $item->port;
|
||||||
|
$array['uuid'] = $user->v2ray_uuid;
|
||||||
|
$array['alterId'] = $user->v2ray_alter_id;
|
||||||
|
$array['cipher'] = 'auto';
|
||||||
|
if ($item->tls) {
|
||||||
|
$array['tls'] = true;
|
||||||
|
}
|
||||||
|
array_push($proxy, $array);
|
||||||
|
array_push($proxies, $item->name);
|
||||||
|
}
|
||||||
|
array_push($proxyGroup, [
|
||||||
|
'name' => config('v2board.app_name', 'V2Board'),
|
||||||
|
'type' => 'select',
|
||||||
|
'proxies' => $proxies
|
||||||
|
]);
|
||||||
|
|
||||||
|
$config = [
|
||||||
|
'port' => 7890,
|
||||||
|
'socks-port' => 0,
|
||||||
|
'allow-lan' => false,
|
||||||
|
'mode' => 'Rule',
|
||||||
|
'log-level' => 'info',
|
||||||
|
'external-controller' => '0.0.0.0:9090',
|
||||||
|
'secret' => '',
|
||||||
|
'Proxy' => $proxy,
|
||||||
|
'Proxy Group' => $proxyGroup,
|
||||||
|
'Rule' => [
|
||||||
|
'DOMAIN-SUFFIX,google.com,'.config('v2board.app_name', 'V2Board'),
|
||||||
|
'DOMAIN-KEYWORD,google,'.config('v2board.app_name', 'V2Board'),
|
||||||
|
'DOMAIN,google.com,'.config('v2board.app_name', 'V2Board'),
|
||||||
|
'DOMAIN-SUFFIX,ad.com,REJECT',
|
||||||
|
'IP-CIDR,127.0.0.0/8,DIRECT',
|
||||||
|
'GEOIP,CN,DIRECT',
|
||||||
|
'MATCH,'.config('v2board.app_name', 'V2Board')
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return Yaml::dump($config);
|
||||||
|
}
|
||||||
|
}
|
12
app/Http/Controllers/Controller.php
Executable file
12
app/Http/Controllers/Controller.php
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use DispatchesJobs, ValidatesRequests;
|
||||||
|
}
|
47
app/Http/Controllers/Guest/OrderController.php
Normal file
47
app/Http/Controllers/Guest/OrderController.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Guest;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Order;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class OrderController extends Controller
|
||||||
|
{
|
||||||
|
public function stripeNotify (Request $request) {
|
||||||
|
Log::info('stripeNotifyData: ' . json_encode($request->input()));
|
||||||
|
|
||||||
|
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||||
|
try {
|
||||||
|
$event = \Stripe\Webhook::constructEvent(
|
||||||
|
file_get_contents('php://input'),
|
||||||
|
$_SERVER['HTTP_STRIPE_SIGNATURE'],
|
||||||
|
config('v2board.stripe_webhook_key')
|
||||||
|
);
|
||||||
|
} catch (\Stripe\Error\SignatureVerification $e) {
|
||||||
|
abort(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj = $event->data->object;
|
||||||
|
if ($obj['status'] == 'succeeded') {
|
||||||
|
$order = Order::where('callback_no', $obj['source']['id'])->first();
|
||||||
|
if (!$order) {
|
||||||
|
abort(500, 'ERROR');
|
||||||
|
}
|
||||||
|
if ($order->status !== 0) {
|
||||||
|
die('SUCCESS');
|
||||||
|
}
|
||||||
|
$order->status = 1;
|
||||||
|
if (!$order->save()) {
|
||||||
|
abort(500, 'ERROR');
|
||||||
|
}
|
||||||
|
die('SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stripeReturn (Request $request) {
|
||||||
|
Log::info('stripeReturnData: ' . json_encode($request->input()));
|
||||||
|
header('Location:' . '/#/dashboard');
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Controllers/Guest/PlanController.php
Executable file
17
app/Http/Controllers/Guest/PlanController.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Guest;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Plan;
|
||||||
|
|
||||||
|
class PlanController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
$plan = Plan::where('show', 1)->get();
|
||||||
|
return response([
|
||||||
|
'data' => $plan
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
57
app/Http/Controllers/InviteController.php
Normal file
57
app/Http/Controllers/InviteController.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\InviteCode;
|
||||||
|
use App\Utils\Helper;
|
||||||
|
|
||||||
|
class InviteController extends Controller
|
||||||
|
{
|
||||||
|
public function save (Request $request) {
|
||||||
|
if (InviteCode::where('user_id', $request->session()->get('id'))->where('status', 0)->count() >= 5) {
|
||||||
|
abort(500, '已达到创建数量上限');
|
||||||
|
}
|
||||||
|
$inviteCode = new InviteCode();
|
||||||
|
$inviteCode->user_id = $request->session()->get('id');
|
||||||
|
$inviteCode->code = Helper::randomChar(8);
|
||||||
|
return response([
|
||||||
|
'data' => $inviteCode->save()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index (Request $request) {
|
||||||
|
$codes = InviteCode::where('user_id', $request->session()->get('id'))
|
||||||
|
->where('status', 0)
|
||||||
|
->get();
|
||||||
|
for ($i = 0; $i < count($codes); $i++) {
|
||||||
|
$codes[$i]['invite_url'] = config('v2board.app_url', env('APP_URL')) . '/#/register?code=' . $codes[$i]['code'];
|
||||||
|
}
|
||||||
|
$stat = [
|
||||||
|
//已注册用户数
|
||||||
|
(int)User::where('invite_user_id', $request->session()->get('id'))->count(),
|
||||||
|
//有效的佣金
|
||||||
|
(int)Order::where('status', 3)
|
||||||
|
->where('commission_status', 1)
|
||||||
|
->where('invite_user_id', $request->session()->get('id'))
|
||||||
|
->sum('commission_balance'),
|
||||||
|
//确认中的佣金
|
||||||
|
(int)Order::where('status', 3)
|
||||||
|
->where('commission_status', 0)
|
||||||
|
->where('invite_user_id', $request->session()->get('id'))
|
||||||
|
->sum('commission_balance'),
|
||||||
|
//已提现佣金
|
||||||
|
0
|
||||||
|
|
||||||
|
];
|
||||||
|
return response([
|
||||||
|
'data' => [
|
||||||
|
'codes' => $codes,
|
||||||
|
'stat' => $stat
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
244
app/Http/Controllers/OrderController.php
Executable file
244
app/Http/Controllers/OrderController.php
Executable file
@ -0,0 +1,244 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Requests\OrderSave;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Utils\Helper;
|
||||||
|
use Omnipay\Omnipay;
|
||||||
|
use Stripe\Stripe;
|
||||||
|
use Stripe\Source;
|
||||||
|
|
||||||
|
class OrderController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
$order = Order::where('user_id', $request->session()->get('id'))
|
||||||
|
->orderBy('created_at', 'DESC')
|
||||||
|
->get();
|
||||||
|
$plan = Plan::get();
|
||||||
|
for($i = 0; $i < count($order); $i++) {
|
||||||
|
for($x = 0; $x < count($plan); $x++) {
|
||||||
|
if ($order[$i]['plan_id'] === $plan[$x]['id']) {
|
||||||
|
$order[$i]['plan'] = $plan[$x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $order
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function details (Request $request) {
|
||||||
|
$order = Order::where('user_id', $request->session()->get('id'))
|
||||||
|
->where('trade_no', $request->input('trade_no'))
|
||||||
|
->first();
|
||||||
|
if (!$order) {
|
||||||
|
abort(500, '订单不存在');
|
||||||
|
}
|
||||||
|
$order['plan'] = Plan::find($order->plan_id);
|
||||||
|
if (!$order['plan']) {
|
||||||
|
abort(500, '订阅不存在');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $order
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save (OrderSave $request) {
|
||||||
|
$plan = Plan::find($request->input('plan_id'));
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
|
||||||
|
if (!$plan) {
|
||||||
|
abort(500, '该订阅不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($plan->show || $user->plan_id == $plan->id)) {
|
||||||
|
abort(500, '该订阅已售罄');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$plan->show && !$plan->renew) {
|
||||||
|
abort(500, '该订阅无法续费,请更换其他订阅');
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = new Order();
|
||||||
|
$order->user_id = $request->session()->get('id');
|
||||||
|
$order->plan_id = $plan->id;
|
||||||
|
$order->cycle = $request->input('cycle');
|
||||||
|
$order->trade_no = Helper::guid();
|
||||||
|
$order->total_amount = $plan[$request->input('cycle')];
|
||||||
|
if ($user->invite_user_id) {
|
||||||
|
$order->invite_user_id = $user->invite_user_id;
|
||||||
|
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', env('DEFAULT_INVITE_COMMISSION')) / 100);
|
||||||
|
}
|
||||||
|
if (!$order->save()) {
|
||||||
|
abort(500, '订单创建失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'data' => $order->trade_no
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkout (Request $request) {
|
||||||
|
$tradeNo = $request->input('trade_no');
|
||||||
|
$method = $request->input('method');
|
||||||
|
$order = Order::where('trade_no', $tradeNo)
|
||||||
|
->where('user_id', $request->session()->get('id'))
|
||||||
|
->where('status', 0)
|
||||||
|
->first();
|
||||||
|
if (!$order) {
|
||||||
|
abort(500, '订单不存在或以支付');
|
||||||
|
}
|
||||||
|
switch ($method) {
|
||||||
|
// return type => 0: QRCode / 1: URL
|
||||||
|
case 0:
|
||||||
|
// alipayF2F
|
||||||
|
if (!(int)config('v2board.alipay_enable')) {
|
||||||
|
abort(500, '支付方式不可用');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'type' => 0,
|
||||||
|
'data' => $this->alipayF2F($tradeNo, $order->total_amount)
|
||||||
|
]);
|
||||||
|
case 2:
|
||||||
|
// stripeAlipay
|
||||||
|
if (!(int)config('v2board.stripe_alipay_enable')) {
|
||||||
|
abort(500, '支付方式不可用');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'type' => 1,
|
||||||
|
'data' => $this->stripeAlipay($order)
|
||||||
|
]);
|
||||||
|
case 3:
|
||||||
|
// stripeWepay
|
||||||
|
if (!(int)config('v2board.stripe_wepay_enable')) {
|
||||||
|
abort(500, '支付方式不可用');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'type' => 0,
|
||||||
|
'data' => $this->stripeWepay($order)
|
||||||
|
]);
|
||||||
|
default:
|
||||||
|
abort(500, '支付方式不存在');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function check (Request $request) {
|
||||||
|
$tradeNo = $request->input('trade_no');
|
||||||
|
$order = Order::where('trade_no', $tradeNo)
|
||||||
|
->where('user_id', $request->session()->get('id'))
|
||||||
|
->first();
|
||||||
|
if (!$order) {
|
||||||
|
abort(500, '订单不存在');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => $order->status
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPaymentMethod () {
|
||||||
|
$data = [];
|
||||||
|
if ((int)config('v2board.alipay_enable')) {
|
||||||
|
$alipayF2F = new \StdClass();
|
||||||
|
$alipayF2F->name = '支付宝';
|
||||||
|
$alipayF2F->method = 0;
|
||||||
|
$alipayF2F->icon = 'alipay';
|
||||||
|
array_push($data, $alipayF2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)config('v2board.stripe_alipay_enable')) {
|
||||||
|
$stripeAlipay = new \StdClass();
|
||||||
|
$stripeAlipay->name = '支付宝';
|
||||||
|
$stripeAlipay->method = 2;
|
||||||
|
$stripeAlipay->icon = 'alipay';
|
||||||
|
array_push($data, $stripeAlipay);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)config('v2board.stripe_wepay_enable')) {
|
||||||
|
$stripeWepay = new \StdClass();
|
||||||
|
$stripeWepay->name = '微信';
|
||||||
|
$stripeWepay->method = 3;
|
||||||
|
$stripeWepay->icon = 'wechat';
|
||||||
|
array_push($data, $stripeWepay);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'data' => $data
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function alipayF2F ($tradeNo, $totalAmount) {
|
||||||
|
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||||
|
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||||
|
$gateway->setAppId(config('v2board.alipay_appid'));
|
||||||
|
$gateway->setPrivateKey(config('v2board.alipay_privkey')); // 可以是路径,也可以是密钥内容
|
||||||
|
$gateway->setAlipayPublicKey(config('v2board.alipay_pubkey')); // 可以是路径,也可以是密钥内容
|
||||||
|
$gateway->setNotifyUrl(config('v2board.app_url', env('APP_URL')) . '/api/v1/guest/order/alipayNotify');
|
||||||
|
$request = $gateway->purchase();
|
||||||
|
$request->setBizContent([
|
||||||
|
'subject' => config('v2board.app_name') . ' - 订阅',
|
||||||
|
'out_trade_no' => $tradeNo,
|
||||||
|
'total_amount' => $totalAmount / 100
|
||||||
|
]);
|
||||||
|
/** @var \Omnipay\Alipay\Responses\AopTradePreCreateResponse $response */
|
||||||
|
$response = $request->send();
|
||||||
|
$result = $response->getAlipayResponse();
|
||||||
|
if ($result['code'] !== '10000') {
|
||||||
|
abort(500, $result['sub_msg']);
|
||||||
|
}
|
||||||
|
// 获取收款二维码内容
|
||||||
|
return $response->getQrCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stripeAlipay ($order) {
|
||||||
|
$exchange = Helper::exchange('CNY', 'HKD');
|
||||||
|
if (!$exchange) {
|
||||||
|
abort(500, '货币转换超时,请稍后再试');
|
||||||
|
}
|
||||||
|
Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||||
|
$source = Source::create([
|
||||||
|
'amount' => floor($order->total_amount * $exchange),
|
||||||
|
'currency' => 'hkd',
|
||||||
|
'type' => 'alipay',
|
||||||
|
'redirect' => [
|
||||||
|
'return_url' => config('v2board.app_url', env('APP_URL')) . '/api/v1/guest/order/stripeReturn'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
if (!$source['redirect']['url']) {
|
||||||
|
abort(500, '支付网关请求失败');
|
||||||
|
}
|
||||||
|
$order->callback_no = $source['id'];
|
||||||
|
if (!$order->save()) {
|
||||||
|
abort(500, '订单更新失败');
|
||||||
|
}
|
||||||
|
return $source['redirect']['url'];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stripeWepay ($order) {
|
||||||
|
$exchange = Helper::exchange('CNY', 'HKD');
|
||||||
|
if (!$exchange) {
|
||||||
|
abort(500, '货币转换超时,请稍后再试');
|
||||||
|
}
|
||||||
|
Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||||
|
$source = Source::create([
|
||||||
|
'amount' => floor($order->total_amount * $exchange),
|
||||||
|
'currency' => 'hkd',
|
||||||
|
'type' => 'wechat',
|
||||||
|
'redirect' => [
|
||||||
|
'return_url' => config('v2board.app_url', env('APP_URL')) . '/api/v1/guest/order/stripeReturn'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
if (!$source['wechat']['qr_code_url']) {
|
||||||
|
abort(500, '支付网关请求失败');
|
||||||
|
}
|
||||||
|
$order->callback_no = $source['id'];
|
||||||
|
if (!$order->save()) {
|
||||||
|
abort(500, '订单更新失败');
|
||||||
|
}
|
||||||
|
return $source['wechat']['qr_code_url'];
|
||||||
|
}
|
||||||
|
}
|
49
app/Http/Controllers/Passport/CommController.php
Normal file
49
app/Http/Controllers/Passport/CommController.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Passport;
|
||||||
|
|
||||||
|
use App\Http\Requests\Passport\CommSendEmailVerify;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
|
class CommController extends Controller
|
||||||
|
{
|
||||||
|
public function isEmailVerify () {
|
||||||
|
return response([
|
||||||
|
'data' => (int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY')) ? 1 : 0
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendEmailVerify (CommSendEmailVerify $request) {
|
||||||
|
$email = $request->input('email');
|
||||||
|
$redisKey = 'sendEmailVerify:' . $email;
|
||||||
|
if (Redis::get($redisKey)) {
|
||||||
|
abort(500, '验证码已发送,请过一会在请求');
|
||||||
|
}
|
||||||
|
$code = rand(100000, 999999);
|
||||||
|
$subject = config('v2board.app_name', 'V2Panel') . '邮箱验证码';
|
||||||
|
Mail::send(
|
||||||
|
'mail.sendEmailVerify',
|
||||||
|
[
|
||||||
|
'code' => $code,
|
||||||
|
'name' => config('v2board.app_name', 'V2Panel')
|
||||||
|
],
|
||||||
|
function ($message) use($email, $subject) {
|
||||||
|
$message->to($email)->subject($subject);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (count(Mail::failures()) >= 1) {
|
||||||
|
// 发送失败
|
||||||
|
abort(500, '发送失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
Redis::set($redisKey, $code);
|
||||||
|
Redis::expire($redisKey, 600);
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
29
app/Http/Controllers/Passport/ForgetController.php
Normal file
29
app/Http/Controllers/Passport/ForgetController.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Passport;
|
||||||
|
|
||||||
|
use App\Http\Requests\Passport\ForgetIndex;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
|
class ForgetController extends Controller
|
||||||
|
{
|
||||||
|
public function index (ForgetIndex $request) {
|
||||||
|
$redisKey = 'sendEmailVerify:' . $request->input('email');
|
||||||
|
if (Redis::get($redisKey) !== $request->input('email_code')) {
|
||||||
|
abort(500, '邮箱验证码有误');
|
||||||
|
}
|
||||||
|
$user = User::where('email', $request->input('email'))->first();
|
||||||
|
$user->password = password_hash($request->input('password'), PASSWORD_DEFAULT);
|
||||||
|
if (!$user->save()) {
|
||||||
|
abort(500, '重置失败');
|
||||||
|
}
|
||||||
|
Redis::del($redisKey);
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
33
app/Http/Controllers/Passport/LoginController.php
Executable file
33
app/Http/Controllers/Passport/LoginController.php
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Passport;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Requests\Passport\LoginIndex;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class LoginController extends Controller
|
||||||
|
{
|
||||||
|
public function index (LoginIndex $request) {
|
||||||
|
$email = $request->input('email');
|
||||||
|
$password = $request->input('password');
|
||||||
|
|
||||||
|
$user = User::where('email', $email)->first();
|
||||||
|
if (!$user) {
|
||||||
|
abort(500, '用户名或密码错误');
|
||||||
|
}
|
||||||
|
if (!password_verify($password, $user->password)) {
|
||||||
|
abort(500, '用户名或密码错误');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->session()->put('email', $user->email);
|
||||||
|
$request->session()->put('id', $user->id);
|
||||||
|
if ($user->is_admin) {
|
||||||
|
$request->session()->put('is_admin', true);
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
71
app/Http/Controllers/Passport/RegisterController.php
Executable file
71
app/Http/Controllers/Passport/RegisterController.php
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Passport;
|
||||||
|
|
||||||
|
use App\Http\Requests\Passport\RegisterIndex;
|
||||||
|
use App\Http\Requests\Passport\RegisterSendEmailVerify;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
use App\Utils\Helper;
|
||||||
|
use App\Models\InviteCode;
|
||||||
|
|
||||||
|
class RegisterController extends Controller
|
||||||
|
{
|
||||||
|
public function index (RegisterIndex $request) {
|
||||||
|
if ((int)config('v2board.stop_register', env('DEFAULT_STOP_REGISTER'))) {
|
||||||
|
abort(500, '本站已关闭注册');
|
||||||
|
}
|
||||||
|
if ((int)config('v2board.invite_force', env('DEFAULT_INVITE_FOCE'))) {
|
||||||
|
if (empty($request->input('invite_code'))) {
|
||||||
|
abort(500, '必须使用邀请码才可以注册');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY'))) {
|
||||||
|
$redisKey = 'sendEmailVerify:' . $request->input('email');
|
||||||
|
if (empty($request->input('email_code'))) {
|
||||||
|
abort(500, '邮箱验证码不能为空');
|
||||||
|
}
|
||||||
|
if (Redis::get($redisKey) !== $request->input('email_code')) {
|
||||||
|
abort(500, '邮箱验证码有误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$email = $request->input('email');
|
||||||
|
$password = $request->input('password');
|
||||||
|
$exist = User::where('email', $email)->first();
|
||||||
|
if ($exist) {
|
||||||
|
abort(500, '邮箱已存在系统中');
|
||||||
|
}
|
||||||
|
$user = new User();
|
||||||
|
$user->email = $email;
|
||||||
|
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
$user->last_login_at = time();
|
||||||
|
$user->v2ray_uuid = Helper::guid(true);
|
||||||
|
$user->token = Helper::guid();
|
||||||
|
if ($request->input('invite_code')) {
|
||||||
|
$inviteCode = InviteCode::where('code', $request->input('invite_code'))
|
||||||
|
->where('status', 0)
|
||||||
|
->first();
|
||||||
|
if (!$inviteCode) {
|
||||||
|
if ((int)config('v2board.invite_force', env('DEFAULT_INVITE_FOCE'))) {
|
||||||
|
abort(500, '邀请码无效');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user->invite_user_id = $inviteCode->user_id ? $inviteCode->user_id : null;
|
||||||
|
$inviteCode->status = 1;
|
||||||
|
$inviteCode->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$user->save()) {
|
||||||
|
abort(500, '注册失败');
|
||||||
|
}
|
||||||
|
if ((int)config('v2board.email_verify', env('DEFAULT_EMAIL_VERIFY'))) {
|
||||||
|
Redis::del($redisKey);
|
||||||
|
}
|
||||||
|
return response()->json([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
25
app/Http/Controllers/PlanController.php
Executable file
25
app/Http/Controllers/PlanController.php
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class PlanController extends Controller
|
||||||
|
{
|
||||||
|
public function info (Request $request) {
|
||||||
|
if (empty($request->input('plan_id'))) {
|
||||||
|
abort(500, '参数错误');
|
||||||
|
}
|
||||||
|
$plan = Plan::find($request->input('plan_id'));
|
||||||
|
if (!$plan) {
|
||||||
|
abort(500, '该订阅不存在');
|
||||||
|
}
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
return response([
|
||||||
|
'data' => $plan
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
18
app/Http/Controllers/Server/Controller.php
Normal file
18
app/Http/Controllers/Server/Controller.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Server;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
public function __construct(Request $request) {
|
||||||
|
$token = $request->input('token');
|
||||||
|
if (empty($token)) {
|
||||||
|
abort(500, 'token is null');
|
||||||
|
}
|
||||||
|
if ($token !== config('v2board.server_token')) {
|
||||||
|
abort(500, 'token is error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
105
app/Http/Controllers/Server/DeepbworkController.php
Normal file
105
app/Http/Controllers/Server/DeepbworkController.php
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Server;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Server\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\ServerLog;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class DeepbworkController extends Controller
|
||||||
|
{
|
||||||
|
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
|
||||||
|
// 后端获取用户
|
||||||
|
public function user (Request $request) {
|
||||||
|
$nodeId = $request->input('node_id');
|
||||||
|
$server = Server::find($nodeId);
|
||||||
|
$users = User::whereIn('group_id', json_decode($server->group_id))
|
||||||
|
->select([
|
||||||
|
'id',
|
||||||
|
'email',
|
||||||
|
't',
|
||||||
|
'u',
|
||||||
|
'd',
|
||||||
|
'transfer_enable',
|
||||||
|
'enable',
|
||||||
|
'v2ray_uuid',
|
||||||
|
'v2ray_alter_id',
|
||||||
|
'v2ray_level'
|
||||||
|
])
|
||||||
|
->get();
|
||||||
|
$result = [];
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$user->v2ray_user = [
|
||||||
|
"uuid" => $user->v2ray_uuid,
|
||||||
|
"email" => sprintf("%s@v2panel.user", $user->v2ray_uuid),
|
||||||
|
"alter_id" => $user->v2ray_alter_id,
|
||||||
|
"level" => $user->v2ray_level,
|
||||||
|
];
|
||||||
|
unset($user['v2ray_uuid']);
|
||||||
|
unset($user['v2ray_alter_id']);
|
||||||
|
unset($user['v2ray_level']);
|
||||||
|
array_push($result, $user);
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'msg' => 'ok',
|
||||||
|
'data' => $result,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后端提交数据
|
||||||
|
public function submit (Request $request) {
|
||||||
|
Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
|
||||||
|
$server = Server::find($request->input('node_id'));
|
||||||
|
if (!$server) {
|
||||||
|
return response([
|
||||||
|
'ret' => 1,
|
||||||
|
'msg' => 'ok'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$data = file_get_contents('php://input');
|
||||||
|
$data = json_decode($data, true);
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$u = $item['u'] * $server->rate;
|
||||||
|
$d = $item['d'] * $server->rate;
|
||||||
|
$user = User::find($item['user_id']);
|
||||||
|
$user->t = time();
|
||||||
|
$user->u = $user->u + $u;
|
||||||
|
$user->d = $user->d + $d;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$serverLog = new ServerLog();
|
||||||
|
$serverLog->user_id = $item['user_id'];
|
||||||
|
$serverLog->node_id = $request->input('node_id');
|
||||||
|
$serverLog->u = $item['u'];
|
||||||
|
$serverLog->d = $item['d'];
|
||||||
|
$serverLog->rate = $server->rate;
|
||||||
|
$serverLog->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'ret' => 1,
|
||||||
|
'msg' => 'ok'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后端获取配置
|
||||||
|
public function config (Request $request) {
|
||||||
|
$nodeId = $request->input('node_id');
|
||||||
|
$localPort = $request->input('local_port');
|
||||||
|
$server = Server::find($nodeId);
|
||||||
|
$jsonData = json_decode(self::SERVER_CONFIG);
|
||||||
|
$jsonData->inboundDetour[0]->port = (int)$localPort;
|
||||||
|
$jsonData->inbound->port = (int)$server->server_port;
|
||||||
|
if ((int)$server->tls) {
|
||||||
|
$jsonData->inbound->streamSettings->security = "tls";
|
||||||
|
$tls = (object) array("certificateFile" => "/home/v2ray.crt", "keyFile" => "/home/v2ray.key");
|
||||||
|
$jsonData->inbound->streamSettings->tlsSettings->certificates[0] = $tls;
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($jsonData, JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
145
app/Http/Controllers/UserController.php
Executable file
145
app/Http/Controllers/UserController.php
Executable file
@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Requests\UserUpdate;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Utils\Helper;
|
||||||
|
use App\Models\Order;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
public function logout (Request $request) {
|
||||||
|
return response([
|
||||||
|
'data' => $request->session()->flush()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changePassword (Request $request) {
|
||||||
|
if (empty($request->input('old_password'))) {
|
||||||
|
abort(500, '旧密码不能为空');
|
||||||
|
}
|
||||||
|
if (empty($request->input('new_password'))) {
|
||||||
|
abort(500, '新密码不能为空');
|
||||||
|
}
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
if (!password_verify($request->input('old_password'), $user->password)) {
|
||||||
|
abort(500, '旧密码有误');
|
||||||
|
}
|
||||||
|
$user->password = password_hash($request->input('new_password'), PASSWORD_DEFAULT);
|
||||||
|
if (!$user->save()) {
|
||||||
|
abort(500, '保存失败');
|
||||||
|
}
|
||||||
|
$request->session()->flush();
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index (Request $request) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save (Request $request) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function info (Request $request) {
|
||||||
|
$user = User::where('id', $request->session()->get('id'))
|
||||||
|
->select([
|
||||||
|
'email',
|
||||||
|
'last_login_at',
|
||||||
|
'created_at',
|
||||||
|
'enable',
|
||||||
|
'is_admin',
|
||||||
|
'remind_expire',
|
||||||
|
'remind_traffic'
|
||||||
|
])
|
||||||
|
->first();
|
||||||
|
$user['avatar_url'] = 'https://cdn.v2ex.com/gravatar/' . md5($user->email) . '?s=64&d=identicon';
|
||||||
|
return response([
|
||||||
|
'data' => $user
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dashboard (Request $request) {
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
if ($user->plan_id) {
|
||||||
|
$user['plan'] = Plan::find($user->plan_id);
|
||||||
|
}
|
||||||
|
$user['subscribe_url'] = config('v2board.app_url', env('APP_URL')) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||||
|
$stat = [
|
||||||
|
Order::where('status', 0)
|
||||||
|
->where('user_id', $request->session()->get('id'))
|
||||||
|
->count(),
|
||||||
|
0,
|
||||||
|
User::where('invite_user_id', $request->session()->get('id'))
|
||||||
|
->count()
|
||||||
|
];
|
||||||
|
return response([
|
||||||
|
'data' => [
|
||||||
|
'user' => $user,
|
||||||
|
'stat' => $stat
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subscribe (Request $request) {
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
$server = [];
|
||||||
|
if ($user->plan_id) {
|
||||||
|
$user['plan'] = Plan::find($user->plan_id);
|
||||||
|
if (!$user['plan']) {
|
||||||
|
abort(500, '订阅计划不存在');
|
||||||
|
}
|
||||||
|
if ($user->expired_at > time()) {
|
||||||
|
$servers = Server::all();
|
||||||
|
foreach ($servers as $item) {
|
||||||
|
$groupId = json_decode($item['group_id']);
|
||||||
|
if (in_array($user->group_id, $groupId)) {
|
||||||
|
array_push($server, $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user['subscribe_url'] = config('v2board.app_url', env('APP_URL')) . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||||
|
return response([
|
||||||
|
'data' => [
|
||||||
|
'user' => $user,
|
||||||
|
'server' => $server
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetUUID (Request $request) {
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
$user->v2ray_uuid = Helper::guid(true);
|
||||||
|
if (!$user->save()) {
|
||||||
|
abort(500, '重置失败');
|
||||||
|
}
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update (UserUpdate $request) {
|
||||||
|
$updateData = $request->only([
|
||||||
|
'remind_expire',
|
||||||
|
'remind_traffic'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::find($request->session()->get('id'));
|
||||||
|
if (!$user) {
|
||||||
|
abort(500, '该用户不存在');
|
||||||
|
}
|
||||||
|
if (!$user->update($updateData)) {
|
||||||
|
abort(500, '保存失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'data' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
90
app/Http/Kernel.php
Executable file
90
app/Http/Kernel.php
Executable file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application's global HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* These middleware are run during every request to your application.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware groups.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\App\Http\Middleware\ForceJson::class,
|
||||||
|
\App\Http\Middleware\CORS::class,
|
||||||
|
'throttle:60,1',
|
||||||
|
'bindings',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware.
|
||||||
|
*
|
||||||
|
* These middleware may be assigned to groups or used individually.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $routeMiddleware = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
|
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||||
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
'user' => \App\Http\Middleware\User::class,
|
||||||
|
'admin' => \App\Http\Middleware\Admin::class,
|
||||||
|
'client' => \App\Http\Middleware\Client::class,
|
||||||
|
'server' => \App\Http\Middleware\Server::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The priority-sorted list of middleware.
|
||||||
|
*
|
||||||
|
* This forces non-global middleware to always be in the given order.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middlewarePriority = [
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\Authenticate::class,
|
||||||
|
\Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
\Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
];
|
||||||
|
}
|
23
app/Http/Middleware/Admin.php
Executable file
23
app/Http/Middleware/Admin.php
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class Admin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
if (!$request->session()->get('is_admin')) {
|
||||||
|
abort(403, '权限不足');
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
21
app/Http/Middleware/Authenticate.php
Executable file
21
app/Http/Middleware/Authenticate.php
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||||
|
|
||||||
|
class Authenticate extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function redirectTo($request)
|
||||||
|
{
|
||||||
|
if (! $request->expectsJson()) {
|
||||||
|
return route('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
app/Http/Middleware/CORS.php
Executable file
27
app/Http/Middleware/CORS.php
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class CORS
|
||||||
|
{
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
$origin = $request->header('origin');
|
||||||
|
if(empty($origin)){
|
||||||
|
$referer = $request->header('referer');
|
||||||
|
if(!empty($referer)&&preg_match("/^((https|http):\/\/)?([^\/]+)/i", $referer, $matches)){
|
||||||
|
$origin = $matches[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response = $next($request);
|
||||||
|
$response->header('Access-Control-Allow-Origin', trim($origin, '/'));
|
||||||
|
$response->header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS');
|
||||||
|
$response->header('Access-Control-Allow-Headers', 'Content-Type,X-Requested-With');
|
||||||
|
$response->header('Access-Control-Allow-Credentials', 'true');
|
||||||
|
$response->header('Access-Control-Max-Age', 10080);
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Middleware/CheckForMaintenanceMode.php
Executable file
17
app/Http/Middleware/CheckForMaintenanceMode.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
||||||
|
|
||||||
|
class CheckForMaintenanceMode extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
30
app/Http/Middleware/Client.php
Executable file
30
app/Http/Middleware/Client.php
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class Client
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
$token = $request->input('token');
|
||||||
|
if (empty($token)) {
|
||||||
|
abort(500, 'token is null');
|
||||||
|
}
|
||||||
|
$user = User::where('token', $token)->first();
|
||||||
|
if (!$user) {
|
||||||
|
abort(500, 'token is error');
|
||||||
|
}
|
||||||
|
$request->user = $user;
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Middleware/EncryptCookies.php
Executable file
17
app/Http/Middleware/EncryptCookies.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||||
|
|
||||||
|
class EncryptCookies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the cookies that should not be encrypted.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
22
app/Http/Middleware/ForceJson.php
Executable file
22
app/Http/Middleware/ForceJson.php
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class ForceJson
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @param string|null $guard
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next, $guard = null)
|
||||||
|
{
|
||||||
|
$request->headers->set('accept', 'application/json');
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
26
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file
26
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class RedirectIfAuthenticated
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @param string|null $guard
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next, $guard = null)
|
||||||
|
{
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect('/home');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
28
app/Http/Middleware/Server.php
Normal file
28
app/Http/Middleware/Server.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class Server
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
$token = $request->input('token');
|
||||||
|
if (empty($token)) {
|
||||||
|
abort(500, 'token is null');
|
||||||
|
}
|
||||||
|
if ($token !== config('v2board.server_token')) {
|
||||||
|
abort(500, 'token is error');
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
18
app/Http/Middleware/TrimStrings.php
Executable file
18
app/Http/Middleware/TrimStrings.php
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||||
|
|
||||||
|
class TrimStrings extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the attributes that should not be trimmed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
}
|
23
app/Http/Middleware/TrustProxies.php
Executable file
23
app/Http/Middleware/TrustProxies.php
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TrustProxies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trusted proxies for this application.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $proxies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The headers that should be used to detect proxies.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||||
|
}
|
23
app/Http/Middleware/User.php
Executable file
23
app/Http/Middleware/User.php
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class User
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
if (!$request->session()->get('id')) {
|
||||||
|
abort(403, '未登录或登陆已过期');
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
24
app/Http/Middleware/VerifyCsrfToken.php
Executable file
24
app/Http/Middleware/VerifyCsrfToken.php
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||||
|
|
||||||
|
class VerifyCsrfToken extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $addHttpCookie = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URIs that should be excluded from CSRF verification.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
63
app/Http/Requests/Admin/ConfigSave.php
Executable file
63
app/Http/Requests/Admin/ConfigSave.php
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ConfigSave extends FormRequest
|
||||||
|
{
|
||||||
|
public static function filter() {
|
||||||
|
return [
|
||||||
|
'invite_force',
|
||||||
|
'invite_commission',
|
||||||
|
'stop_register',
|
||||||
|
'email_verify',
|
||||||
|
'app_name',
|
||||||
|
'app_url',
|
||||||
|
'invite_gen_limit',
|
||||||
|
'server_token',
|
||||||
|
// alipay
|
||||||
|
'alipay_enable',
|
||||||
|
'alipay_appid',
|
||||||
|
'alipay_pubkey',
|
||||||
|
'alipay_privkey',
|
||||||
|
// stripe
|
||||||
|
'stripe_sk_live',
|
||||||
|
'stripe_pk_live',
|
||||||
|
'stripe_alipay_enable',
|
||||||
|
'stripe_wepay_enable',
|
||||||
|
'stripe_webhook_key'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'invite_force' => 'in:0,1',
|
||||||
|
'invite_commission' => 'integer',
|
||||||
|
'stop_register' => 'in:0,1',
|
||||||
|
'email_verify' => 'in:0,1',
|
||||||
|
'invite_gen_limit' => 'integer',
|
||||||
|
'server_token' => 'min:16',
|
||||||
|
'app_url' => 'url',
|
||||||
|
// alipay
|
||||||
|
'alipay_enable' => 'in:0,1',
|
||||||
|
'alipay_appid' => 'integer|min:16',
|
||||||
|
'alipay_pubkey' => 'max:2048',
|
||||||
|
'alipay_privkey' => 'max:2048',
|
||||||
|
// stripe
|
||||||
|
'stripe_alipay_enable' => 'in:0,1',
|
||||||
|
'stripe_wepay_enable' => 'in:0,1'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
31
app/Http/Requests/Admin/PlanSave.php
Executable file
31
app/Http/Requests/Admin/PlanSave.php
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class PlanSave extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required',
|
||||||
|
'group_id' => 'required',
|
||||||
|
'transfer_enable' => 'required'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name.required' => '套餐名称不能为空',
|
||||||
|
'group_id.required' => '权限组不能为空',
|
||||||
|
'transfer_enable' => '流量不能为空'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
29
app/Http/Requests/Admin/PlanUpdate.php
Normal file
29
app/Http/Requests/Admin/PlanUpdate.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class PlanUpdate extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'show' => 'in:0,1',
|
||||||
|
'renew' => 'in:0,1'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'show.in' => '销售状态格式不正确',
|
||||||
|
'renew.in' => '续费状态格式不正确'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
43
app/Http/Requests/Admin/ServerSave.php
Executable file
43
app/Http/Requests/Admin/ServerSave.php
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ServerSave extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required',
|
||||||
|
'group_id' => 'required|array',
|
||||||
|
'host' => 'required',
|
||||||
|
'port' => 'required',
|
||||||
|
'server_port' => 'required',
|
||||||
|
'tls' => 'required',
|
||||||
|
'tags' => 'array',
|
||||||
|
'rate' => 'required|numeric'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name.required' => '节点名称不能为空',
|
||||||
|
'group_id.required' => '权限组不能为空',
|
||||||
|
'group_id.array' => '权限组格式不正确',
|
||||||
|
'host.required' => '节点地址不能为空',
|
||||||
|
'port.required' => '连接端口不能为空',
|
||||||
|
'server_port.required' => '后端服务端口不能为空',
|
||||||
|
'tls.required' => 'TLS不能为空',
|
||||||
|
'tags.array' => '标签格式不正确',
|
||||||
|
'rate.required' => '倍率不能为空',
|
||||||
|
'rate.numeric' => '倍率格式不正确'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
38
app/Http/Requests/Admin/UserUpdate.php
Normal file
38
app/Http/Requests/Admin/UserUpdate.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class UserUpdate extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => 'required|email',
|
||||||
|
'transfer_enable' => 'numeric',
|
||||||
|
'expired_at' => 'integer',
|
||||||
|
'banned' => 'required|in:0,1',
|
||||||
|
'is_admin' => 'required|in:0,1'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => '邮箱不能为空',
|
||||||
|
'email.email' => '邮箱格式不正确',
|
||||||
|
'transfer_enable.numeric' => '流量格式不正确',
|
||||||
|
'expired_at.integer' => '到期时间格式不正确',
|
||||||
|
'banned.required' => '是否封禁不能为空',
|
||||||
|
'banned.in' => '是否封禁格式不正确',
|
||||||
|
'is_admin.required' => '是否管理员不能为空',
|
||||||
|
'is_admin.in' => '是否管理员格式不正确'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
30
app/Http/Requests/OrderSave.php
Executable file
30
app/Http/Requests/OrderSave.php
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class OrderSave extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'plan_id' => 'required',
|
||||||
|
'cycle' => 'required|in:month_price,quarter_price,half_year_price,year_price'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'plan_id.required' => '套餐ID不能为空',
|
||||||
|
'cycle.required' => '套餐周期不能为空',
|
||||||
|
'cycle.in' => '套餐周期有误'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
app/Http/Requests/Passport/CommSendEmailVerify.php
Normal file
28
app/Http/Requests/Passport/CommSendEmailVerify.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Passport;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class CommSendEmailVerify extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => 'required|email'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => '邮箱不能为空',
|
||||||
|
'email.email' => '邮箱格式不正确'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
33
app/Http/Requests/Passport/ForgetIndex.php
Normal file
33
app/Http/Requests/Passport/ForgetIndex.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Passport;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class ForgetIndex extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required|min:8',
|
||||||
|
'email_code' => 'required'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => '邮箱不能为空',
|
||||||
|
'email.email' => '邮箱格式不正确',
|
||||||
|
'password.required' => '密码不能为空',
|
||||||
|
'password.min' => '密码必须大于8位数',
|
||||||
|
'email_code.required' => '邮箱验证码不能为空'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
31
app/Http/Requests/Passport/LoginIndex.php
Normal file
31
app/Http/Requests/Passport/LoginIndex.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Passport;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class LoginIndex extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required|min:8'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => '邮箱不能为空',
|
||||||
|
'email.email' => '邮箱格式不正确',
|
||||||
|
'password.required' => '密码不能为空',
|
||||||
|
'password.min' => '密码必须大于8位数'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
31
app/Http/Requests/Passport/RegisterIndex.php
Executable file
31
app/Http/Requests/Passport/RegisterIndex.php
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Passport;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class RegisterIndex extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required|min:8'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => '邮箱不能为空',
|
||||||
|
'email.email' => '邮箱格式不正确',
|
||||||
|
'password.required' => '密码不能为空',
|
||||||
|
'password.min' => '密码必须大于8位数'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
29
app/Http/Requests/UserUpdate.php
Normal file
29
app/Http/Requests/UserUpdate.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class UserUpdate extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'remind_expire' => 'in:0,1',
|
||||||
|
'remind_traffic' => 'in:0,1'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'show.in' => '过期提醒格式不正确',
|
||||||
|
'renew.in' => '流量提醒格式不正确'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
11
app/Models/InviteCode.php
Normal file
11
app/Models/InviteCode.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class InviteCode extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_invite_code';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
}
|
11
app/Models/Order.php
Executable file
11
app/Models/Order.php
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Order extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_order';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
}
|
12
app/Models/Plan.php
Executable file
12
app/Models/Plan.php
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Plan extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_plan';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
11
app/Models/Server.php
Executable file
11
app/Models/Server.php
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Server extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_server';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
}
|
11
app/Models/ServerGroup.php
Executable file
11
app/Models/ServerGroup.php
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ServerGroup extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_server_group';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
}
|
11
app/Models/ServerLog.php
Normal file
11
app/Models/ServerLog.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ServerLog extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_server_log';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
}
|
12
app/Models/User.php
Executable file
12
app/Models/User.php
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class User extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'v2_user';
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
}
|
28
app/Providers/AppServiceProvider.php
Executable file
28
app/Providers/AppServiceProvider.php
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
30
app/Providers/AuthServiceProvider.php
Executable file
30
app/Providers/AuthServiceProvider.php
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
// 'App\Model' => 'App\Policies\ModelPolicy',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerPolicies();
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
21
app/Providers/BroadcastServiceProvider.php
Executable file
21
app/Providers/BroadcastServiceProvider.php
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
Broadcast::routes();
|
||||||
|
|
||||||
|
require base_path('routes/channels.php');
|
||||||
|
}
|
||||||
|
}
|
34
app/Providers/EventServiceProvider.php
Executable file
34
app/Providers/EventServiceProvider.php
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
73
app/Providers/RouteServiceProvider.php
Executable file
73
app/Providers/RouteServiceProvider.php
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* This namespace is applied to your controller routes.
|
||||||
|
*
|
||||||
|
* In addition, it is set as the URL generator's root namespace.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $namespace = 'App\Http\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$this->mapApiRoutes();
|
||||||
|
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes()
|
||||||
|
{
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->namespace)
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes()
|
||||||
|
{
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->namespace)
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
52
app/Utils/Helper.php
Executable file
52
app/Utils/Helper.php
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Utils;
|
||||||
|
|
||||||
|
class Helper
|
||||||
|
{
|
||||||
|
public static function guid ($format = false) {
|
||||||
|
if (function_exists('com_create_guid') === true) {
|
||||||
|
return md5(trim(com_create_guid(), '{}'));
|
||||||
|
}
|
||||||
|
$data = openssl_random_pseudo_bytes(16);
|
||||||
|
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
|
||||||
|
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
|
||||||
|
if ($format) {
|
||||||
|
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||||
|
}
|
||||||
|
return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)).'-'.time());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function exchange ($from, $to) {
|
||||||
|
$result = file_get_contents('https://api.exchangeratesapi.io/latest?symbols=' . $to . '&base=' . $from);
|
||||||
|
$result = json_decode($result, true);
|
||||||
|
return $result['rates'][$to];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function randomChar($len, $special=false){
|
||||||
|
$chars = array(
|
||||||
|
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
|
||||||
|
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
|
||||||
|
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
|
||||||
|
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
|
||||||
|
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
|
||||||
|
"3", "4", "5", "6", "7", "8", "9"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($special){
|
||||||
|
$chars = array_merge($chars, array(
|
||||||
|
"!", "@", "#", "$", "?", "|", "{", "/", ":", ";",
|
||||||
|
"%", "^", "&", "*", "(", ")", "-", "_", "[", "]",
|
||||||
|
"}", "<", ">", "~", "+", "=", ",", "."
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$charsLen = count($chars) - 1;
|
||||||
|
shuffle($chars);
|
||||||
|
$str = '';
|
||||||
|
for($i=0; $i<$len; $i++){
|
||||||
|
$str .= $chars[mt_rand(0, $charsLen)];
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
}
|
53
artisan
Executable file
53
artisan
Executable 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 our classes "manually". Feels 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);
|
55
bootstrap/app.php
Executable file
55
bootstrap/app.php
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bind Important Interfaces
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, we need to bind some important interfaces into the container so
|
||||||
|
| we will be able to resolve them when needed. The kernels serve the
|
||||||
|
| incoming requests to this application from both the web and CLI.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Http\Kernel::class,
|
||||||
|
App\Http\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Console\Kernel::class,
|
||||||
|
App\Console\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||||
|
App\Exceptions\Handler::class
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Return The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
2
bootstrap/cache/.gitignore
vendored
Executable file
2
bootstrap/cache/.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
64
composer.json
Executable file
64
composer.json
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The Laravel Framework.",
|
||||||
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"laravel"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2",
|
||||||
|
"fideloper/proxy": "^4.0",
|
||||||
|
"laravel/framework": "^6.0",
|
||||||
|
"laravel/tinker": "^1.0",
|
||||||
|
"lokielse/omnipay-alipay": "3.0.6",
|
||||||
|
"stripe/stripe-php": "^7.5",
|
||||||
|
"symfony/yaml": "^4.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"facade/ignition": "^1.4",
|
||||||
|
"fzaninotto/faker": "^1.4",
|
||||||
|
"mockery/mockery": "^1.0",
|
||||||
|
"nunomaduro/collision": "^3.0",
|
||||||
|
"phpunit/phpunit": "^8.0"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/"
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"database/seeds",
|
||||||
|
"database/factories"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
4886
composer.lock
generated
Executable file
4886
composer.lock
generated
Executable file
File diff suppressed because it is too large
Load Diff
231
config/app.php
Executable file
231
config/app.php
Executable file
@ -0,0 +1,231 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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' => 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,
|
||||||
|
'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,
|
||||||
|
'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,
|
||||||
|
'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,
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
103
config/auth.php
Executable file
103
config/auth.php
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default authentication "guard" and password
|
||||||
|
| reset options for your application. You may change these defaults
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
'passwords' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| here which uses session storage and the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| Supported: "session", "token"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
'driver' => 'token',
|
||||||
|
'provider' => 'users',
|
||||||
|
'hash' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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\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 the reset token should 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,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
59
config/broadcasting.php
Executable file
59
config/broadcasting.php
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Broadcaster
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default broadcaster that will be used by the
|
||||||
|
| framework when an event needs to be broadcast. You may set this to
|
||||||
|
| any of the connections defined in the "connections" array below.
|
||||||
|
|
|
||||||
|
| Supported: "pusher", "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,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'driver' => 'log',
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'null',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
103
config/cache.php
Executable file
103
config/cache.php
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache connection that gets used while
|
||||||
|
| using this caching library. This connection is used when another is
|
||||||
|
| not explicitly specified when executing a given caching function.
|
||||||
|
|
|
||||||
|
| Supported: "apc", "array", "database", "file",
|
||||||
|
| "memcached", "redis", "dynamodb"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'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.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'apc' => [
|
||||||
|
'driver' => 'apc',
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'cache',
|
||||||
|
'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',
|
||||||
|
],
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
|
||||||
|
];
|
147
config/database.php
Executable file
147
config/database.php
Executable file
@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Database Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify which of the database connections below you wish
|
||||||
|
| to use as your default connection for all database work. Of course
|
||||||
|
| you may use many connections at once using the Database library.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here are each of the database connections setup for your application.
|
||||||
|
| Of course, examples of configuring each database platform that is
|
||||||
|
| supported by Laravel is shown below to make development simple.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
| All database work in Laravel is done through the PHP PDO facilities
|
||||||
|
| so make sure you have the driver for your particular database of
|
||||||
|
| choice installed on your machine before you begin development.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
|
'prefix' => '',
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
],
|
||||||
|
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'pgsql' => [
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '5432'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'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),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
69
config/filesystems.php
Executable file
69
config/filesystems.php
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application. Just store away!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cloud Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Many applications store files both locally and in the cloud. For this
|
||||||
|
| reason, you may specify a default "cloud" driver here. This driver
|
||||||
|
| will be bound as the Cloud disk implementation in the container.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
52
config/hashing.php
Executable file
52
config/hashing.php
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Hash Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default hash driver that will be used to hash
|
||||||
|
| passwords for your application. By default, the bcrypt algorithm is
|
||||||
|
| used; however, you remain free to modify this option if you wish.
|
||||||
|
|
|
||||||
|
| Supported: "bcrypt", "argon", "argon2id"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => 'bcrypt',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bcrypt Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'bcrypt' => [
|
||||||
|
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Argon Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Argon algorithm. These will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'argon' => [
|
||||||
|
'memory' => 8192,
|
||||||
|
'threads' => 2,
|
||||||
|
'time' => 2,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
94
config/logging.php
Executable file
94
config/logging.php
Executable file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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' => ['daily'],
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => 'debug',
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => 'debug',
|
||||||
|
'days' => 14,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => 'Laravel Log',
|
||||||
|
'emoji' => ':boom:',
|
||||||
|
'level' => 'critical',
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => 'debug',
|
||||||
|
'handler' => SyslogUdpHandler::class,
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => 'debug',
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => 'debug',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
136
config/mail.php
Executable file
136
config/mail.php
Executable file
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mail Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
||||||
|
| sending of e-mail. You may specify which one you're using throughout
|
||||||
|
| your application here. By default, Laravel is setup for SMTP mail.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||||
|
| "postmark", "log", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('MAIL_DRIVER', 'smtp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| SMTP Host Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may provide the host address of the SMTP server used by your
|
||||||
|
| applications. A default option is provided that is compatible with
|
||||||
|
| the Mailgun mail service which will provide reliable deliveries.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| SMTP Host Port
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the SMTP port used by your application to deliver e-mails to
|
||||||
|
| users of the application. Like the host we have set this value to
|
||||||
|
| stay compatible with the Mailgun e-mail application by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'port' => env('MAIL_PORT', 587),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| E-Mail Encryption Protocol
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the encryption protocol that should be used when
|
||||||
|
| the application send e-mail messages. A sensible default using the
|
||||||
|
| transport layer security protocol should provide great security.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| SMTP Server Username
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If your SMTP server requires a username for authentication, you should
|
||||||
|
| set it here. This will get used to authenticate with your server on
|
||||||
|
| connection. You may also set the "password" value below this one.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sendmail System Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "sendmail" driver to send e-mails, we will need to know
|
||||||
|
| the path to where Sendmail lives on this server. A default path has
|
||||||
|
| been provided here, which will work well on most of your systems.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using the "log" driver, you may specify the logging channel
|
||||||
|
| if you prefer to keep mail messages separate from other log entries
|
||||||
|
| for simpler reading. Otherwise, the default channel will be used.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
|
||||||
|
];
|
88
config/queue.php
Executable file
88
config/queue.php
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue API supports an assortment of back-ends via a single
|
||||||
|
| API, giving you convenient access to each back-end using the same
|
||||||
|
| syntax for every one. Here you may define a default connection.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection information for each server that
|
||||||
|
| is used by your application. A default configuration has been added
|
||||||
|
| for each back-end shipped with Laravel. You are free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'jobs',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => 0,
|
||||||
|
],
|
||||||
|
|
||||||
|
'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', 'your-queue-name'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
33
config/services.php
Executable file
33
config/services.php
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'domain' => env('MAILGUN_DOMAIN'),
|
||||||
|
'secret' => env('MAILGUN_SECRET'),
|
||||||
|
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
199
config/session.php
Executable file
199
config/session.php
Executable file
@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Session Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default session "driver" that will be used on
|
||||||
|
| requests. By default, we will use the lightweight native driver but
|
||||||
|
| you may specify any of the other wonderful drivers provided here.
|
||||||
|
|
|
||||||
|
| Supported: "file", "cookie", "database", "apc",
|
||||||
|
| "memcached", "redis", "dynamodb", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Lifetime
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the number of minutes that you wish the session
|
||||||
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
|
| to immediately expire on the browser closing, set that option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Encryption
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to easily specify that all of your session data
|
||||||
|
| should be encrypted before it is stored. All encryption will be run
|
||||||
|
| automatically by Laravel and you can use the Session like normal.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encrypt' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session File Location
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the native session driver, we need a location where session
|
||||||
|
| files may be stored. A default has been set for you but a different
|
||||||
|
| location may be specified. This is only needed for file sessions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Connection
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" or "redis" session drivers, you may specify a
|
||||||
|
| connection that should be used to manage these sessions. This should
|
||||||
|
| correspond to a connection in your database configuration options.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION', 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
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "apc", "memcached", or "dynamodb" session drivers 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".
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'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 if it can not be done securely.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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
|
||||||
|
| do not enable this as other CSRF protection services are in place.
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'same_site' => null,
|
||||||
|
|
||||||
|
];
|
36
config/view.php
Executable file
36
config/view.php
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| View Storage Paths
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Most templating systems load templates from disk. Here you may specify
|
||||||
|
| an array of paths that should be checked for your views. Of course
|
||||||
|
| the usual Laravel view path has already been registered for you.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Compiled View Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines where all the compiled Blade templates will be
|
||||||
|
| stored for your application. Typically, this is within the storage
|
||||||
|
| directory. However, as usual, you are free to change this value.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'compiled' => env(
|
||||||
|
'VIEW_COMPILED_PATH',
|
||||||
|
realpath(storage_path('framework/views'))
|
||||||
|
),
|
||||||
|
|
||||||
|
];
|
2
database/.gitignore
vendored
Executable file
2
database/.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
*.sqlite
|
||||||
|
*.sqlite-journal
|
27
database/factories/UserFactory.php
Executable file
27
database/factories/UserFactory.php
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||||
|
use App\User;
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Model Factories
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This directory should contain each of the model factory definitions for
|
||||||
|
| your application. Factories provide a convenient way to generate new
|
||||||
|
| model instances for testing / seeding your application's database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$factory->define(User::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'name' => $faker->name,
|
||||||
|
'email' => $faker->unique()->safeEmail,
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||||
|
'remember_token' => Str::random(10),
|
||||||
|
];
|
||||||
|
});
|
36
database/migrations/2014_10_12_000000_create_users_table.php
Executable file
36
database/migrations/2014_10_12_000000_create_users_table.php
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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->bigIncrements('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email')->unique();
|
||||||
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
$table->string('password');
|
||||||
|
$table->rememberToken();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
}
|
||||||
|
}
|
32
database/migrations/2014_10_12_100000_create_password_resets_table.php
Executable file
32
database/migrations/2014_10_12_100000_create_password_resets_table.php
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreatePasswordResetsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('password_resets', function (Blueprint $table) {
|
||||||
|
$table->string('email')->index();
|
||||||
|
$table->string('token');
|
||||||
|
$table->timestamp('created_at')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('password_resets');
|
||||||
|
}
|
||||||
|
}
|
35
database/migrations/2019_08_19_000000_create_failed_jobs_table.php
Executable file
35
database/migrations/2019_08_19_000000_create_failed_jobs_table.php
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateFailedJobsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->text('connection');
|
||||||
|
$table->text('queue');
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->longText('exception');
|
||||||
|
$table->timestamp('failed_at')->useCurrent();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('failed_jobs');
|
||||||
|
}
|
||||||
|
}
|
16
database/seeds/DatabaseSeeder.php
Executable file
16
database/seeds/DatabaseSeeder.php
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Seed the application's database.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// $this->call(UsersTableSeeder::class);
|
||||||
|
}
|
||||||
|
}
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: v2board-db
|
||||||
|
image: mysql
|
||||||
|
environment:
|
||||||
|
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
||||||
|
volumes:
|
||||||
|
- ./docker/mysql:/var/lib/mysql
|
||||||
|
- ./install.sql:/install.sql
|
||||||
|
phpfpm:
|
||||||
|
image: bitnami/php-fpm
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
depends_on:
|
||||||
|
- phpfpm
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- ./docker/nginx:/etc/nginx/conf.d
|
||||||
|
ports:
|
||||||
|
- 8964:80
|
||||||
|
|
2
docker/mysql/.gitignore
vendored
Executable file
2
docker/mysql/.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
3
docker/nginx/.gitignore
vendored
Executable file
3
docker/nginx/.gitignore
vendored
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!nginx.conf
|
52
docker/nginx/nginx.conf
Normal file
52
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
server {
|
||||||
|
# 监听 HTTP 协议默认的 [80] 端口。
|
||||||
|
listen 80;
|
||||||
|
# 绑定主机名 [example.com]。
|
||||||
|
server_name localhost;
|
||||||
|
# 服务器站点根目录 [/example.com/public]。
|
||||||
|
root /app/public;
|
||||||
|
|
||||||
|
# 添加几条有关安全的响应头;与 Google+ 的配置类似,详情参见文末。
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Content-Type-Options "nosniff";
|
||||||
|
|
||||||
|
# 站点默认页面;可指定多个,将顺序查找。
|
||||||
|
# 例如,访问 http://example.com/ Nginx 将首先尝试「站点根目录/index.html」是否存在,不存在则继续尝试「站点根目录/index.htm」,以此类推...
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
# 指定字符集为 UTF-8
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
# Laravel 默认重写规则;删除将导致 Laravel 路由失效且 Nginx 响应 404。
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 关闭 [/favicon.ico] 和 [/robots.txt] 的访问日志。
|
||||||
|
# 并且即使它们不存在,也不写入错误日志。
|
||||||
|
location = /favicon.ico { access_log off; log_not_found off; }
|
||||||
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
|
# 将 [404] 错误交给 [/index.php] 处理,表示由 Laravel 渲染美观的错误页面。
|
||||||
|
error_page 404 /index.php;
|
||||||
|
|
||||||
|
# URI 符合正则表达式 [\.php$] 的请求将进入此段配置
|
||||||
|
location ~ \.php$ {
|
||||||
|
# 配置 FastCGI 服务地址,可以为 IP:端口,也可以为 Unix socket。
|
||||||
|
fastcgi_pass phpfpm:9000;
|
||||||
|
# 配置 FastCGI 的主页为 index.php。
|
||||||
|
fastcgi_index index.php;
|
||||||
|
# 配置 FastCGI 参数 SCRIPT_FILENAME 为 $realpath_root$fastcgi_script_name。
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
# 引用更多默认的 FastCGI 参数。
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
# 通俗地说,以上配置将所有 URI 以 .php 结尾的请求,全部交给 PHP-FPM 处理。
|
||||||
|
|
||||||
|
# 除符合正则表达式 [/\.(?!well-known).*] 之外的 URI,全部拒绝访问
|
||||||
|
# 也就是说,拒绝公开以 [.] 开头的目录,[.well-known] 除外
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
2
init.sh
Executable file
2
init.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
php artisan key:generate
|
||||||
|
php artisan config:cache
|
129
install.sql
Normal file
129
install.sql
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
-- Adminer 4.7.3 MySQL dump
|
||||||
|
|
||||||
|
SET NAMES utf8;
|
||||||
|
SET time_zone = '+00:00';
|
||||||
|
SET foreign_key_checks = 0;
|
||||||
|
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_invite_code`;
|
||||||
|
CREATE TABLE `v2_invite_code` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`user_id` int(11) NOT NULL,
|
||||||
|
`code` char(32) NOT NULL,
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_order`;
|
||||||
|
CREATE TABLE `v2_order` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`invite_user_id` int(11) DEFAULT NULL,
|
||||||
|
`user_id` int(11) NOT NULL,
|
||||||
|
`plan_id` int(11) NOT NULL,
|
||||||
|
`cycle` varchar(255) NOT NULL,
|
||||||
|
`trade_no` varchar(36) NOT NULL,
|
||||||
|
`callback_no` varchar(255) DEFAULT NULL,
|
||||||
|
`total_amount` int(11) NOT NULL,
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`commission_status` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`commission_balance` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_plan`;
|
||||||
|
CREATE TABLE `v2_plan` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`group_id` int(11) NOT NULL,
|
||||||
|
`transfer_enable` int(11) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`show` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`renew` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`content` text,
|
||||||
|
`month_price` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`quarter_price` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`half_year_price` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`year_price` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_server`;
|
||||||
|
CREATE TABLE `v2_server` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`group_id` varchar(255) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`host` varchar(255) NOT NULL,
|
||||||
|
`port` int(11) NOT NULL,
|
||||||
|
`server_port` int(11) NOT NULL,
|
||||||
|
`tls` tinyint(4) NOT NULL,
|
||||||
|
`tags` varchar(255) NOT NULL DEFAULT '[]',
|
||||||
|
`rate` varchar(11) NOT NULL,
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_server_group`;
|
||||||
|
CREATE TABLE `v2_server_group` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_server_log`;
|
||||||
|
CREATE TABLE `v2_server_log` (
|
||||||
|
`user_id` int(11) NOT NULL,
|
||||||
|
`u` varchar(255) NOT NULL,
|
||||||
|
`d` varchar(255) NOT NULL,
|
||||||
|
`rate` int(11) NOT NULL,
|
||||||
|
`node_id` int(11) NOT NULL,
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `v2_user`;
|
||||||
|
CREATE TABLE `v2_user` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`invite_user_id` int(11) DEFAULT NULL,
|
||||||
|
`email` varchar(64) NOT NULL,
|
||||||
|
`password` varchar(64) NOT NULL,
|
||||||
|
`commission_balance` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`t` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`u` bigint(20) NOT NULL DEFAULT '0',
|
||||||
|
`d` bigint(20) NOT NULL DEFAULT '0',
|
||||||
|
`transfer_enable` bigint(20) NOT NULL DEFAULT '0',
|
||||||
|
`enable` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`banned` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`last_login_at` int(11) NOT NULL,
|
||||||
|
`last_login_ip` int(11) DEFAULT NULL,
|
||||||
|
`v2ray_uuid` varchar(36) NOT NULL,
|
||||||
|
`v2ray_alter_id` tinyint(4) NOT NULL DEFAULT '2',
|
||||||
|
`v2ray_level` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`group_id` int(11) DEFAULT NULL,
|
||||||
|
`plan_id` int(11) DEFAULT NULL,
|
||||||
|
`remind_expire` tinyint(4) DEFAULT '1',
|
||||||
|
`remind_traffic` tinyint(4) DEFAULT '1',
|
||||||
|
`token` char(32) NOT NULL,
|
||||||
|
`expired_at` bigint(20) NOT NULL DEFAULT '0',
|
||||||
|
`created_at` int(11) NOT NULL,
|
||||||
|
`updated_at` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `email` (`email`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- 2019-10-29 06:15:21
|
21
package.json
Executable file
21
package.json
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npm run development",
|
||||||
|
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"watch": "npm run development -- --watch",
|
||||||
|
"watch-poll": "npm run watch -- --watch-poll",
|
||||||
|
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"prod": "npm run production",
|
||||||
|
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"axios": "^0.19",
|
||||||
|
"cross-env": "^5.1",
|
||||||
|
"laravel-mix": "^4.0.7",
|
||||||
|
"lodash": "^4.17.13",
|
||||||
|
"resolve-url-loader": "^2.3.1",
|
||||||
|
"sass": "^1.15.2",
|
||||||
|
"sass-loader": "^7.1.0"
|
||||||
|
}
|
||||||
|
}
|
41
phpunit.xml
Executable file
41
phpunit.xml
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit backupGlobals="false"
|
||||||
|
backupStaticAttributes="false"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnFailure="false">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory suffix="Test.php">./tests/Unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
|
||||||
|
<testsuite name="Feature">
|
||||||
|
<directory suffix="Test.php">./tests/Feature</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">./app</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<extensions>
|
||||||
|
<extension class="Tests\Bootstrap"/>
|
||||||
|
</extensions>
|
||||||
|
<php>
|
||||||
|
<server name="APP_ENV" value="testing"/>
|
||||||
|
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||||
|
<server name="CACHE_DRIVER" value="array"/>
|
||||||
|
<server name="MAIL_DRIVER" value="array"/>
|
||||||
|
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
<server name="SESSION_DRIVER" value="array"/>
|
||||||
|
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
|
||||||
|
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
|
||||||
|
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
|
||||||
|
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
|
||||||
|
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
0
public/favicon.ico
Executable file
0
public/favicon.ico
Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user