first commit

This commit is contained in:
kizzroyal 2022-02-16 14:01:00 +07:00
commit f876f79060
294 changed files with 92083 additions and 0 deletions

15
.editorconfig Normal file
View 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

49
.env.example Normal file
View File

@ -0,0 +1,49 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
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}"

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

6
.htaccess Normal file
View File

@ -0,0 +1,6 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
</IfModule>
php_value memory_limit 256M

13
.styleci.yml Normal file
View File

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

62
README.md Normal file
View File

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

View File

@ -0,0 +1,156 @@
<?php
namespace App\Console\Commands;
use App\Http\Repositories\AttendanceSessionRepository;
use App\Models\AttendanceSession;
use App\Models\AttendanceSetting;
use App\Models\LichSuChoiMomo;
use App\Models\Setting;
use App\Models\UserAttendanceSession;
use App\Traits\PhoneNumber;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class HandleBotAttendanceSession extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:handle-bot-attendance-session';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* @var \App\Http\Repositories\AttendanceSessionRepository
*/
protected $attendanceSessionRepository;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
$this->attendanceSessionRepository = new AttendanceSessionRepository();
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
var_dump("Bat dau xu ly luc: ".Carbon::now()->toTimeString());
$isTurnOn = $this->attendanceSessionRepository->checkTurOnAttendance();
if ($isTurnOn) {
$config = $this->attendanceSessionRepository->getAttendanceSetting();
$startTime = isset($config['start_time']) ? Carbon::parse($config['start_time']) : Carbon::parse(TIME_START_ATTENDANCE);
$endTime = isset($config['end_time']) ? Carbon::parse($config['end_time']) : Carbon::parse(TIME_END_ATTENDANCE);
$timeEach = $config['time_each'];
$now = Carbon::now();
if ($now->between($startTime, $endTime)) {
try {
$attendanceSetting = $this->attendanceSessionRepository->getAttendanceSetting();
$attendanceSessionCurrent = AttendanceSession::where('date', Carbon::today()->toDateString())
->orderBy('created_at', "DESC")
// ->where('status', STATUS_ACTIVE)
->first();
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent);
$phoneUserAttendance = $usersAttendance->pluck('phone')->toArray();
$botRate = $attendanceSetting['bot_rate'] ?? 10;
$bots = $this->attendanceSessionRepository->getRandomBotsAttendance($botRate,
$phoneUserAttendance);
$randomNumberTakeBot = random_int(10, 40);
$phoneBots = collect($bots)
->take(round(($randomNumberTakeBot / 100) * count($bots)))
->pluck("phone")
->toArray();
$countBot = count(collect($bots));
$botHandled = [];
sleep(3);
$realtimeSecond = $this->attendanceSessionRepository->getSecondsRealtime();
$timeRun = $realtimeSecond;
for ($i = 0; $i <= $timeRun; $i++) {
$realtimeSecond = $this->attendanceSessionRepository->getSecondsRealtime();
if (count($botHandled) == count($bots) || $realtimeSecond < 1) {
return Command::SUCCESS;
}
if ($countBot < 50) {
$numberBotInsert = random_int(0, 3);
} else {
$numberBotInsert = random_int(0, 5);
}
Log::warning("BOT INSERT: ".$numberBotInsert);
$botsHandling = collect($phoneBots)->take($numberBotInsert)->toArray();
foreach ($botsHandling as $index => $phoneBot) {
DB::table('users_attendance_session')->insert([
'phone' => $phoneBot,
'session_id' => $attendanceSessionCurrent->id,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]);
unset($phoneBots[array_search($phoneBot, $phoneBots)]);
}
$botHandled = array_merge($botHandled, $botsHandling);
$sleepWithTimeEach = $this->getSleepSecondByTimeEach($timeEach);
$maxSleep = $realtimeSecond < $sleepWithTimeEach[1] ? $realtimeSecond - 1 : $sleepWithTimeEach[1];
$minSleep = $maxSleep < $sleepWithTimeEach[0] ? 1 : $sleepWithTimeEach[0];
var_dump($minSleep, $maxSleep, $realtimeSecond);
$sleepInt = random_int($minSleep, $maxSleep);
var_dump("sleep:".$sleepInt);
sleep($sleepInt);
// } else {
// sleep(random_int(1, 3));
// }
}
var_dump("Xu ly xong luc: ".Carbon::now()->toTimeString());
return Command::SUCCESS;
} catch (\Throwable $throwable) {
Log::info($throwable);
}
}
}
}
private function getSleepSecondByTimeEach($timeEach)
{
switch ($timeEach) {
case 60:
default;
return [2, 5];
case 180:
return [5, 10];
case 300:
return [10, 30];
case 600:
return [15, 75];
case 900:
return [15, 90];
case 1200:
return [15, 120];
case 1800:
return [60, 180];
case 3600:
return [60, 360];
case 21600:
return [120, 600];
case 86400:
return [600, 3600];
}
}
}

View File

@ -0,0 +1,221 @@
<?php
namespace App\Console\Commands;
use App\Http\Repositories\AttendanceSessionRepository;
use App\Models\AccountMomo;
use App\Models\AttendanceSetting;
use App\Models\LichSuChoiMomo;
use App\Models\Setting;
use App\Traits\PhoneNumber;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Queue\Listener;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class HandleUserWinAttendanceSession extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:handle-user-win-attendance-session';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* @var \App\Http\Repositories\AttendanceSessionRepository
*/
protected $attendanceSessionRepository;
/**
* @var \App\Traits\PhoneNumber
*/
protected $convertPhoneNumber;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
$this->attendanceSessionRepository = new AttendanceSessionRepository();
$this->convertPhoneNumber = new PhoneNumber();
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
var_dump("Bat dau xu ly luc: ".Carbon::now()->toTimeString());
// Log::info("Bat dau xu ly luc: ".Carbon::now()->toTimeString());
try {
$isTurnOn = $this->attendanceSessionRepository->checkTurOnAttendance();
if ($isTurnOn) {
$realtimeSecond = $this->attendanceSessionRepository->getSecondsRealtime();
$timeRun = $realtimeSecond;
for ($i = 0; $i < $timeRun; $i++) {
$realtimeSecond = $this->attendanceSessionRepository->getSecondsRealtime();
// Log::info("Chay :".$realtimeSecond);
if ($realtimeSecond > 1) {
sleep(1);
// $realtimeSecond--;
continue;
} else {
$config = $this->attendanceSessionRepository->getAttendanceSetting();
$startTime = isset($config['start_time']) ? Carbon::parse($config['start_time']) : Carbon::parse(TIME_START_ATTENDANCE);
$endTime = isset($config['end_time']) ? Carbon::parse($config['end_time']) : Carbon::parse(TIME_END_ATTENDANCE);
// Log::info("Chay :".$realtimeSecond);
$now = Carbon::now();
if ($now->between($startTime, $endTime)) {
$currentAttendanceSession = $this->attendanceSessionRepository->getCurrentAttendanceSession();
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($currentAttendanceSession);
// Log::info("Count users: ".count($usersAttendance));
if (count($usersAttendance) == 0) {
return Command::SUCCESS;
}
$this->attendanceSessionRepository->createNewAttendanceSession($currentAttendanceSession);
$randomInt = random_int(1, 10);
$billCode = 'AUTO-'.bin2hex(random_bytes(3)).time().'-CLUB';
$amount = random_int($config['money_min'] ?? MONEY_MIN_WIN_ATTENDANCE,
$config['money_max'] ?? MONEY_MAX_WIN_ATTENDANCE);
$winRate = isset($config['win_rate']) ? $config['win_rate'] / 10 : ATTENDANCE_WIN_RATE_DEFAULT;
$usersAttendance = $usersAttendance->transform(function($userAtten) {
$userAtten->phone = $this->convertPhoneNumber->convert($userAtten->phone);
return $userAtten;
});
if ($randomInt > $winRate) {
$phoneWin = $this->handleBotWin($usersAttendance);
} else {
$phoneWin = $this->handleUserWin($usersAttendance, $billCode,
$amount);
}
Log::info($phoneWin);
$currentAttendanceSession->update([
'phone' => $phoneWin,
'amount' => $amount,
'bill_code' => $billCode,
]);
break;
}
}
}
}
Log::info("DONE!!!");
var_dump("Xu ly xong luc: ".Carbon::now()->toTimeString());
return Command::SUCCESS;
} catch (\Throwable $throwable) {
Log::info($throwable);
}
}
/**
* @return mixed
*/
public function getUserLichSuMomo()
{
return LichSuChoiMomo::where('created_at', '>=', Carbon::today())->get();
}
/**
* @param $usersAttendance
* @param string $billCode
* @param int $amount
*
* @return mixed|null
* @throws \Exception
*/
private function handleUserWin($usersAttendance, string $billCode, int $amount)
{
$usersMomo = $this->getUserLichSuMomo();
$usersMomo = $usersMomo->transform(function($user) {
$user->phone = $this->convertPhoneNumber->convert($user->sdt);
return $user;
});
$usersMomoPhone = $usersMomo->pluck('phone')->unique()->toArray();
$usersAttendance = $usersAttendance->filter(function($userAttendance) use (
$usersMomoPhone
) {
return in_array($userAttendance->phone, $usersMomoPhone);
});
$phoneUsersAttendance = $usersAttendance->pluck('phone')->toArray();
$countPhoneUsersAttendance = count($phoneUsersAttendance) > 0 ? count($phoneUsersAttendance) - 1 : 0;
$phoneWin = $phoneUsersAttendance[random_int(0,
$countPhoneUsersAttendance)] ?? null;
if (is_null($phoneWin)) {
$phoneWin = $this->handleBotWin($usersAttendance);
} else {
$phoneGet = $this->getPhoneAccountMomo();
// Log::info("set phone win");
$attendanceSetting = AttendanceSetting::first();
$setPhoneWin = $attendanceSetting->setphonewin;
if($setPhoneWin != null || $setPhoneWin != ''){
$phoneWin = $setPhoneWin;
AttendanceSetting::first()->update(['setphonewin' => null]);
}
// Log::info("end phone win");
DB::table('lich_su_choi_momos')->insert([
'sdt' => $phoneWin,
'sdt_get' => $phoneGet,
'magiaodich' => $billCode,
'tiencuoc' => 0,
'tiennhan' => $amount,
'trochoi' => "DIEM DANH",
'noidung' => "DD",
'ketqua' => 1,
'status' => STATUS_LSMOMO_CHUA_THANH_TOAN,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]);
}
return $phoneWin;
}
/**
* @param $usersAttendance
*
* @return int|mixed
* @throws \Exception
*/
public function handleBotWin($usersAttendance)
{
$phoneBots = $this->attendanceSessionRepository->getPhoneAttendanceSessionBots();
$phonesUserAttendance = $usersAttendance->pluck('phone')->toArray();
$phoneBotsWin = array_values(array_intersect($phoneBots, $phonesUserAttendance));
if (count($phoneBotsWin) > 0) {
$phoneBotWin = $phoneBotsWin[random_int(0, count($phoneBotsWin) - 1)];
} else {
$phoneBotWin = $phoneBots[random_int(0, count($phoneBots) - 1)];
}
return $phoneBotWin;
}
/**
* @return mixed
*/
private function getPhoneAccountMomo()
{
$cache = Cache::get('cache_get_sdt_account_momo');
if (!is_null($cache)) {
return $cache;
}
$account = AccountMomo::where('status', '1')->first();
$phone = $account->sdt;
Cache::put('cache_get_sdt_account_momo', $phone, Carbon::now()->addMinutes(10));
return $phone;
}
}

46
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace App\Console;
use App\Console\Commands\HandleBotAttendanceSession;
use App\Console\Commands\HandleUserWinAttendanceSession;
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 = [
HandleUserWinAttendanceSession::class,
HandleBotAttendanceSession::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('command:handle-bot-attendance-session')->everyMinute()->withoutOverlapping();
$schedule->command('command:handle-user-win-attendance-session')->everyMinute()->withoutOverlapping();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

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

View File

@ -0,0 +1,117 @@
<?php
namespace App\Http\Controllers;
use App\Http\Repositories\AccountMomoRepository;
use App\Models\AccountLevelMoney;
use App\Models\AccountMomo;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use stdClass;
class AccountLevelMoneyController extends Controller
{
public function __construct()
{
}
//
public function index()
{
$GetSetting = new stdClass;
$accountMomoRepo = new AccountMomoRepository();
$accounts = $accountMomoRepo->getListAccountMomosLevels();
$accountsMomo = $accountMomoRepo->getListAccountMomos(true);
$GetSetting->namepage = 'Quản lý hạn mức SĐT';
$GetSetting->title = 'Quản lý hạn mức SĐT';
$GetSetting->description = 'Quản lý hạn mức SĐT';
$GetSetting->description = 'Tạo mới';
$titleModal = 'Tạo mới';
$types = Config::get('constant.list_game');
return view('AdminPage.AccountLevelMoney.index',
compact('GetSetting', 'titleModal', 'accounts', 'accountsMomo', 'types'));
}
public function store()
{
$data = request()->all();
$paramKeys = ['sdt', 'type', 'min', 'max'];
if (!$this->validateParameterKeys($paramKeys, $data)) {
return $this->responseMissingParameters();
}
if (!is_numeric($data['min']) || !is_numeric($data['max']) || !is_numeric($data['sdt'])) {
return $this->responseError($data, "Dữ liệu gửi lên không hợp lệ");
}
if ((int)($data['min']) >= (int)$data['max']) {
return $this->responseError($data, "Giá trị min phải nhỏ hơn giá trị max");
}
AccountLevelMoney::create($data);
Cache::forget('cache_list_account_momos_active');
Session::flash('message', 'Lưu dữ liệu thành công');
return $this->responseSuccess();
}
public function edit()
{
$data = request()->all();
$paramKeys = ['id'];
if (!$this->validateParameterKeys($paramKeys, $data)) {
return $this->responseMissingParameters();
}
$account = AccountLevelMoney::where('id', $data['id'])->first();
if (is_null($account)) {
return $this->responseMissingParameters();
}
$accountMomoRepo = new AccountMomoRepository();
$accountsMomo = $accountMomoRepo->getListAccountMomos();
$types = Config::get('constant.list_game');
$titleModal = "Cập nhật";
return view('AdminPage.AccountLevelMoney.form_template',
compact('account', 'titleModal', 'accountsMomo', 'types'));
}
public function update()
{
$data = request()->all();
$paramKeys = ['id', 'sdt', 'type', 'min', 'max'];
if (!$this->validateParameterKeys($paramKeys, $data)) {
return $this->responseMissingParameters();
}
if (!is_numeric($data['min']) || !is_numeric($data['max']) || !is_numeric($data['sdt'])) {
return $this->responseError($data, "Dữ liệu gửi lên không hợp lệ");
}
if ((int)($data['min']) >= (int)$data['max']) {
return $this->responseError($data, "Giá trị min phải nhỏ hơn giá trị max");
}
$account = AccountLevelMoney::where('id', $data['id'])->update($data);
if (!$account) {
return $this->responseMissingParameters();
}
$account = AccountLevelMoney::where('id', $data['id'])->first();
Cache::forget('cache_list_account_momos_active');
return view('AdminPage.AccountLevelMoney.row', compact('account'));
}
public function delete()
{
$data = request()->all();
$paramKeys = ['id'];
if (!$this->validateParameterKeys($paramKeys, $data)) {
return $this->responseMissingParameters();
}
$account = AccountLevelMoney::where('id', $data['id'])->update(['status' => STATUS_DE_ACTIVE]);
if (is_null($account)) {
return $this->responseMissingParameters();
}
Cache::forget('cache_list_account_momos_active');
return $this->responseSuccess();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function validateParameterKeys($paramKeys, $data)
{
$validate = true;
foreach ($paramKeys as $key) {
if (!isset($data[$key])) {
$validate = false;
break;
}
}
return $validate;
}
public function responseMissingParameters()
{
return [
'status' => 2,
'message' => 'Thiếu dữ liệu gửi lên',
];
}
public function responseSuccess($data = [], $message = "")
{
return [
'status' => 1,
'message' => $message,
'data' => $data,
];
}
public function responseError($data = [], $message = "")
{
return [
'status' => 2,
'message' => $message,
'data' => $data,
];
}
}

View File

@ -0,0 +1,465 @@
<?php
namespace App\Http\Controllers;
use App\Http\Repositories\AccountMomoRepository;
use App\Http\Repositories\AttendanceDateRepository;
use App\Http\Repositories\AttendanceSessionRepository;
use App\Traits\PhoneNumber;
use Illuminate\Http\Request;
use App\Models\Setting;
use App\Models\ChanLe;
use App\Models\TaiXiu;
use App\Models\ChanLe2;
use App\Models\Gap3;
use App\Models\Tong3So;
use App\Models\X1Phan3;
use App\Models\AccountMomo;
use App\Models\LichSuChoiMomo;
use App\Models\SettingPhanThuongTop;
use Illuminate\Http\Response;
use Illuminate\Support\Carbon;
use App\Models\NoHuu;
use App\Models\LichSuChoiNoHu;
use App\Models\LichSuBank;
use App\Models\TopTuan;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use Cache;
class HomeController extends Controller
{
//index
protected $attendanceSessionRepository;
protected $attendanceDateRepository;
protected $accountMomoRepo;
public function __construct()
{
$this->attendanceSessionRepository = new AttendanceSessionRepository();
$this->attendanceDateRepository = new AttendanceDateRepository();
$this->accountMomoRepo = new AccountMomoRepository();
}
public function index()
{
//Lịch sử chơi Momo
if (Cache::has('indexData')) {
return view(
'HomePage.home',
Cache::get('indexData')
);
}
//Setting
$Setting = new Setting;
$GetSetting = $Setting->first();
$GetSetting->namepage = 'Trang chủ';
// $accountMomosGroupTypes = $this->accountMomoRepo->getListAccountMomosGroupType();
//Bảo trì
//Chẵn lẻ
[
$Setting_ChanLe,
$Setting_TaiXiu,
$Setting_ChanLe2,
$Setting_Gap3,
$Setting_Tong3So,
$Setting_1Phan3,
] = $this->getSetingGame();
$UserTopTuan = [];
//Phần thưởng tuần
$SettingPhanThuongTop = new SettingPhanThuongTop;
$GetSettingPhanThuongTop = $SettingPhanThuongTop->get();
//Setting nổ hũ
$NoHuu = new NoHuu;
$Setting_NoHu = $NoHuu->first();
//Thông báo nổ hũ
$LichSuChoiNoHu = new LichSuChoiNoHu;
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
'status' => 3,
'ketqua' => 1,
])->get();
$GetLichSuChoiNoHus = [];
$dem = 0;
foreach ($GetLichSuChoiNoHu as $row) {
$GetLichSuChoiNoHus[$dem] = $row;
$GetLichSuChoiNoHus[$dem]['sdt2'] = substr($row['sdt'], 0, 6).'******';
$GetLichSuChoiNoHus[$dem]['tiennhan2'] = $row['tiennhan'] + $Setting_NoHu->tienmacdinh;
$dem++;
}
$secondRealTime = $this->attendanceSessionRepository->getSecondsRealtime();
$dataAttendanceSession = $this->attendanceSessionRepository->getDataAttendanceSession();
$attendanceSessionCurrent = $dataAttendanceSession['current'];
$listSessionsPast = $dataAttendanceSession['sessions_past'];
$phoneWinLatest = $dataAttendanceSession['phone_win_latest'];
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent);
$totalAmount = $this->attendanceSessionRepository->getTotalAmountAttendanceSession();
$countUsersAttendance = count($usersAttendance);
$listUserAttendance = $usersAttendance->take(10);
$checkCanAttendance = $this->attendanceSessionRepository->checkTurOnAttendance();
$checkCanAttendanceDate = $this->attendanceDateRepository->checkTurOnAttendanceDate();
$setting = $this->attendanceSessionRepository->getAttendanceSetting();
$timeEach = $setting['time_each'] ?? TIME_EACH_ATTENDANCE_SESSION;
$startTime = isset($setting['start_time']) ? Carbon::parse($setting['start_time']) : Carbon::parse(TIME_START_ATTENDANCE);
$endTime = isset($setting['end_time']) ? Carbon::parse($setting['end_time']) : Carbon::parse(TIME_END_ATTENDANCE);
$now = Carbon::now();
$canAttendance = $now->between($startTime, $endTime) && $checkCanAttendance;
$configAttendanceDate = $this->attendanceDateRepository->getMocchoi();
//View
$data = view(
'HomePage.home',
compact(
'GetSetting',
// 'accountMomosGroupTypes',
'Setting_ChanLe',
'Setting_TaiXiu',
'Setting_ChanLe2',
'Setting_Gap3',
'Setting_Tong3So',
'Setting_1Phan3',
'UserTopTuan',
'GetSettingPhanThuongTop',
'GetLichSuChoiNoHus',
'attendanceSessionCurrent',
'secondRealTime',
'listSessionsPast',
'countUsersAttendance',
'phoneWinLatest',
'usersAttendance',
'listUserAttendance',
'canAttendance',
'totalAmount',
'checkCanAttendance',
'setting',
'timeEach',
'checkCanAttendanceDate',
'configAttendanceDate',
)
);
Cache::put('indexData', compact(
'GetSetting',
// 'accountMomosGroupTypes',
'Setting_ChanLe',
'Setting_TaiXiu',
'Setting_ChanLe2',
'Setting_Gap3',
'Setting_Tong3So',
'Setting_1Phan3',
'UserTopTuan',
'GetSettingPhanThuongTop',
'GetLichSuChoiNoHus',
'attendanceSessionCurrent',
'secondRealTime',
'listSessionsPast',
'countUsersAttendance',
'phoneWinLatest',
'usersAttendance',
'listUserAttendance',
'canAttendance',
'totalAmount',
'checkCanAttendance',
'setting',
'timeEach',
'checkCanAttendanceDate',
'configAttendanceDate',
), TIME_CACHE_LOAD_DATA + 30);
return $data;
}
public function realTimeAttendance(Request $request)
{
$timeLast = $request->all();
$updateCache = $timeLast % 20 == 0;
$secondsRealtime = $this->attendanceSessionRepository->getSecondsRealtime($updateCache);
$dataAttendanceSession = $this->attendanceSessionRepository->getDataAttendanceSession();
$attendanceSessionCurrent = $dataAttendanceSession['current'];
$phoneWinLatest = $dataAttendanceSession['phone_win_latest'];
$listSessionsPast = $dataAttendanceSession['sessions_past'];
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent);
$countUsersAttendance = count($usersAttendance);
$usersAttendance = $usersAttendance->transform(function($user) {
$user->phone = $user->getPhone();
return $user;
});
$phoneUsersAttendance = $usersAttendance->pluck('phone')->toArray();
$totalAmount = $this->attendanceSessionRepository->getTotalAmountAttendanceSession();
$phonesAttendance = view('HomePage.phone_user_attendance', compact('phoneUsersAttendance'))->render();
$viewListSessionPast = view('HomePage.table_sessions_attendance', compact('listSessionsPast'))->render();
return json_encode([
'session_current_code' => $attendanceSessionCurrent->id,
'phone_win_latest' => $phoneWinLatest,
'count_users_attendance' => $countUsersAttendance,
'phones_attendance' => $phonesAttendance,
'total_amount' => number_format($totalAmount),
'view_list_session_past' => $viewListSessionPast,
'second_realtime' => $secondsRealtime,
], true);
}
public function attendanceSession(Request $request)
{
$data = $request->all();
if (!isset($data['phone'])) {
return response(['status' => 2, 'message' => "Có lỗi xảy ra vui lòng thử lại"]);
}
if (!is_numeric($data['phone']) || !$this->isDigits($data['phone'])) {
return response(['status' => 2, 'message' => "Số điện thoại sai định dạng. Vui lòng kiểm tra lại"]);
}
$startTime = Carbon::parse(TIME_START_ATTENDANCE);
$endTime = Carbon::parse(TIME_END_ATTENDANCE);
$now = Carbon::now();
if (!$now->between($startTime, $endTime)) {
return response(['status' => 2, 'message' => "Thời gian bắt đầu điểm danh từ 7h sáng đến 11h hằng ngày!"]);
}
if ($this->checkPhoneHasAttendanceSessionCurrent($data['phone'])) {
return response(['status' => 2, 'message' => "Số điện thoại của bạn đã điểm danh trong phiên này!"]);
}
$this->attendanceSessionRepository->insertUsersAttendanceSession($data);
return "SUCCESS";
}
public function attendanceDate(Request $request)
{
$data = $request->all();
if (!isset($data['phone'])) {
return response(['status' => 2, 'message' => "Có lỗi xảy ra vui lòng thử lại"]);
}
if (!$this->attendanceDateRepository->checkTurOnAttendanceDate()) {
return response(['status' => 2, 'message' => "Hệ thống đang bảo trì"]);
}
$data = $this->attendanceDateRepository->handleAttendanceDate($data);
return $data;
}
private function checkPhoneHasAttendanceSessionCurrent($phone)
{
$recordsOfPhone = $this->attendanceSessionRepository->queryUsersAttendanceByPhone($phone);
return count($recordsOfPhone) > 0;
}
public function isDigits(string $s, int $minDigits = 9, int $maxDigits = 14): bool
{
return preg_match('/^[0-9]{'.$minDigits.','.$maxDigits.'}\z/', $s);
}
public function getDataAfterLoad()
{
//Lịch sử chơi Momo
if (Cache::has('AllData')) {
return Cache::get('AllData');
}
//Lịch sử chơi Momo
$LichSuChoiMomo = new LichSuChoiMomo;
$LichSuChoiMomoToDay = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([
'ketqua' => 1,
'status' => 3,
])->orderBy('id', 'desc')->get();
$accountMomosGroupTypes = $this->accountMomoRepo->getListAccountMomosWithAccountLevel();
$accountMomosGroupTypesAllGames = collect();
if (!is_null($accountMomosGroupTypes->get(CONFIG_ALL_GAME)) && count($accountMomosGroupTypes->get(CONFIG_ALL_GAME)) > 0) {
$accountMomosGroupTypesAllGames = $accountMomosGroupTypes->get(CONFIG_ALL_GAME);
}
$ListLichSuChoiMomo = $LichSuChoiMomoToDay->take(5);
$ListAccounts = $this->getTrangthaiMomo();
$UserTopTuan = $this->getTopTuan($LichSuChoiMomo);
//$UserTopTuan=[];
[
$Setting_ChanLe,
$Setting_TaiXiu,
$Setting_ChanLe2,
$Setting_Gap3,
$Setting_Tong3So,
$Setting_1Phan3,
] = $this->getSetingGame();
$viewLichSuThang = view('HomePage.table_lich_su_thang', compact('ListLichSuChoiMomo'))->render();
$viewUserTopTuan = view('HomePage.top_tuan', compact('UserTopTuan'))->render();
$viewTrangthaiMomo = view('HomePage.table_trang_thai_momo', compact('ListAccounts'))->render();
$viewTaleAccount = [];
$types = Config::get('constant.list_game');
foreach ($types as $type => $label) {
if (!view()->exists('HomePage.table_account_'.$type)) {
continue;
}
$viewTaleAccount[$type] = view('HomePage.table_account_'.$type,
compact('accountMomosGroupTypes', 'accountMomosGroupTypesAllGames'))->render();
}
$data=[
'lich_su_thang' => $viewLichSuThang,
'view_table_account' => $viewTaleAccount,
'view_table_trang_thai_momo' => $viewTrangthaiMomo,
'view_top_tuan' => $viewUserTopTuan,
'tiencuoc_'.CONFIG_CHAN_LE => $Setting_ChanLe['tile'],
'tiencuoc_'.CONFIG_TAI_XIU => $Setting_TaiXiu['tile'],
'tiencuoc_'.CONFIG_CHAN_LE_TAI_XIU_2 => $Setting_ChanLe2['tile'],
'tiencuoc_'.CONFIG_1_PHAN_3 => $Setting_1Phan3['tile'],
'tiencuoc_'.CONFIG_GAP_3.'_1' => $Setting_Gap3['tile1'],
'tiencuoc_'.CONFIG_GAP_3.'_2' => $Setting_Gap3['tile2'],
'tiencuoc_'.CONFIG_GAP_3.'_3' => $Setting_Gap3['tile3'],
'tiencuoc_'.CONFIG_TONG_3_SO.'_1' => $Setting_Tong3So['tile1'],
'tiencuoc_'.CONFIG_TONG_3_SO.'_2' => $Setting_Tong3So['tile2'],
'tiencuoc_'.CONFIG_TONG_3_SO.'_3' => $Setting_Tong3So['tile3'],
];
// set cache tồn tại trong 30s
Cache::put('AllData', $data, TIME_CACHE_LOAD_DATA);
return $data;
}
public function getPhone($phone)
{
$middle_string = "";
$length = strlen($phone);
if ($length < 3) {
return $length == 1 ? "*" : "*".substr($phone, -1);
} else {
$part_size = floor($length / 3);
$middle_part_size = $length - ($part_size * 2);
for ($i = 0; $i < $middle_part_size; $i++) {
$middle_string .= "*";
}
return substr($phone, 0, $part_size).$middle_string.substr($phone, -$part_size);
}
}
/**
* @param \App\Models\AccountMomo $AccountMomo
*
* @return array
*/
private function getSetingGame(): array
{
$AccountMomo = new AccountMomo;
$ChanLe = new ChanLe;
$Setting_ChanLe = $ChanLe->first();
$Setting_ChanLe->sdt2 = $AccountMomo->GetListAccountID($Setting_ChanLe->sdt);
$Setting_ChanLe = $Setting_ChanLe->toArray();
//Tài xỉu
$TaiXiu = new TaiXiu;
$Setting_TaiXiu = $TaiXiu->first();
$Setting_TaiXiu->sdt2 = $AccountMomo->GetListAccountID($Setting_TaiXiu->sdt);
$Setting_TaiXiu = $Setting_TaiXiu->toArray();
//Chẵn lẻ 2
$ChanLe2 = new ChanLe2;
$Setting_ChanLe2 = $ChanLe2->first();
$Setting_ChanLe2->sdt2 = $AccountMomo->GetListAccountID($Setting_ChanLe2->sdt);
$Setting_ChanLe2 = $Setting_ChanLe2->toArray();
//Gấp 3
$Gap3 = new Gap3;
$Setting_Gap3 = $Gap3->first();
$Setting_Gap3->sdt2 = $AccountMomo->GetListAccountID($Setting_Gap3->sdt);
$Setting_Gap3 = $Setting_Gap3->toArray();
//Tổng 3 Số
$Tong3So = new Tong3So;
$Setting_Tong3So = $Tong3So->first();
$Setting_Tong3So->sdt2 = $AccountMomo->GetListAccountID($Setting_Tong3So->sdt);
$Setting_Tong3So = $Setting_Tong3So->toArray();
//1 Phần 3
$X1Phan3 = new X1Phan3;
$Setting_1Phan3 = $X1Phan3->first();
$Setting_1Phan3->sdt2 = $AccountMomo->GetListAccountID($Setting_1Phan3->sdt);
$Setting_1Phan3 = $Setting_1Phan3->toArray();
return [
$Setting_ChanLe,
$Setting_TaiXiu,
$Setting_ChanLe2,
$Setting_Gap3,
$Setting_Tong3So,
$Setting_1Phan3,
];
}
/**
* @param \App\Models\LichSuChoiMomo $LichSuChoiMomo
*
* @return mixed
*/
private function getTopTuan(LichSuChoiMomo $LichSuChoiMomo)
{
$topTuan= new TopTuan;
$UserTopTuan=[];
$getTopTuan = $topTuan->whereBetween('created_at',
[Carbon::today()->startOfWeek(), Carbon::today()->endOfWeek()])
->orderBy('tongtientuan', 'desc')->limit(5)->get();
foreach($getTopTuan as $row){
$UserTopTuan[$this->getPhone($row->sdt)] = $row->tongtientuan;
}
return $UserTopTuan;
// $lichSuChoiMomoTuan = $LichSuChoiMomo->whereBetween('created_at',
// [Carbon::today()->startOfWeek(), Carbon::today()->endOfWeek()])
// // ->where('ketqua', 1)
// ->where('status', 3)
// ->get();
// $UserTopTuan = $lichSuChoiMomoTuan->map(function($lichSu) {
// $phoneConvert = new PhoneNumber();
// $lichSu->sdt = $phoneConvert->convert($lichSu->sdt, true);
// $lichSu->sdt = $this->getPhone($lichSu->sdt);
// return $lichSu;
// })->groupBy('sdt')->map(function($lichSuPhone) {
// return $lichSuPhone->sum('tiencuoc');
// })->sortByDesc(function($tiencuoc) {
// return $tiencuoc;
// })->take(5)->toArray();
// return $UserTopTuan;
}
/**
* @return \Illuminate\Support\Collection
*/
private function getTrangthaiMomo(): \Illuminate\Support\Collection
{
//Trạng thái MOMO
$ListAccounts = $this->accountMomoRepo->getListAccountMomosWithAccountLevel(false);
return $ListAccounts->map(function($account) {
$account['status_class'] = "success";
$account['status_text'] = "hoạt động";
return $account;
});
// $LichSuBank = new LichSuBank;
// $accounts = collect($this->accountMomoRepo->getListAccountMomos());
// $LichSuBanks = $LichSuBank->whereDate('created_at', Carbon::today())->get();
// $ListAccounts = collect($accounts)->map(function($account) use (
// $LichSuChoiMomoToDay,
// $LichSuBanks
// ) {
// $GetLichSuChoiMomo = $LichSuChoiMomoToDay->where('sdt_get', $account['sdt']);
// $getLichSuBank = $LichSuBanks->where('sdtbank', $account['sdt']);
// $responseLichSuBank = $getLichSuBank->pluck('response')->toArray();
// $countbank = 0;
// foreach ($responseLichSuBank as $response) {
// $j = json_decode($response, true);
// if (isset($j['status']) && $j['status'] == 200) {
// $countbank++;
// }
// }
// $account['sent_money'] = $GetLichSuChoiMomo->sum('tiennhan');
// $account['status_class'] = "success";
// $account['status_text'] = "hoạt động";
// $account['countbank'] = $countbank;
//
// return $account;
// })->take(5);
return $ListAccounts;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\NoHuu;
use App\Models\LichSuChoiNoHu;
use App\Models\AccountMomo;
class NoHuController extends Controller
{
//
public function Get_Hu(request $request){
//Setting nổ hũ
$NoHuu = new NoHuu;
$Setting_NoHu = $NoHuu->first();
$LichSuChoiNoHu = new LichSuChoiNoHu;
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
'status' => 3,
])->get();
$tongtien = $Setting_NoHu->tienmacdinh;
foreach ($GetLichSuChoiNoHu as $row) {
$tongtien = $tongtien + $row->tienvaohu;
$tongtien = $tongtien - $row->tiennhan;
}
return response()->json([
'tongtien' => $tongtien,
]);
}
public function Load_Hu(request $request){
//Setting nổ hũ
$NoHuu = new NoHuu;
$Setting_NoHu = $NoHuu->first();
$LichSuChoiNoHu = new LichSuChoiNoHu;
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
'status' => 3,
])->get();
$tongtien = $Setting_NoHu->tienmacdinh;
foreach ($GetLichSuChoiNoHu as $row) {
$tongtien = $tongtien + $row->tienvaohu;
$tongtien = $tongtien - $row->tiennhan;
}
//
$AccountMomo = new AccountMomo;
$GetAccountMomo = $AccountMomo->where([
'status' => 1,
])->get();
$GetAccountMomos = [];
$dem = 0;
foreach ($GetAccountMomo as $row) {
$GetAccountMomos[$dem]['sdt'] = $row->sdt;
$dem ++;
}
$sotienchuyen = $Setting_NoHu->tiencuoc;
//
return response()->json([
'tongtien' => $tongtien,
'tongtien_format' => number_format($tongtien),
'list_sdt' => $GetAccountMomos,
'sotienchuyen' => $sotienchuyen,
]);
}
}

67
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,67 @@
<?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\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
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' => [
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* 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,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'maintenance_system' => \App\Http\Middleware\MaintenanceSystem::class,
];
}

View File

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

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use App\Http\Repositories\AttendanceSessionRepository;
use Closure;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class MaintenanceSystem extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
public function handle($request, Closure $next)
{
$repo = new AttendanceSessionRepository();
$config = $repo->getSettingWebsite();
if ($config['baotri'] == 1){
return redirect(route('bao_tri'));
}
return $next($request);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View File

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

View File

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

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View 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|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,114 @@
<?php
/**
*File name : AccountMomoRepository.php / Date: 1/4/2022 - 8:55 PM
*Code Owner: Thanhnt/ Email: Thanhnt@omt.com.vn/ Phone: 0384428234
*/
namespace App\Http\Repositories;
use App\Models\AccountLevelMoney;
use App\Models\AccountMomo;
use App\Models\LichSuBank;
use App\Models\LichSuChoiMomo;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class AccountMomoRepository
{
public function getListAccountMomosLevels()
{
$cache = Cache::get('cache_list_account_momos_active');
$cache = null;
if (!is_null($cache)) {
return $cache;
}
$listAccountMomos = $this->getListAccountMomos(true, [STATUS_ACTIVE, STATUS_MAINTENANCE]);
$levelAccounts = AccountLevelMoney::where('status', STATUS_ACTIVE)->get()->map(function($account) use (
$listAccountMomos
) {
$accountMomo = collect($listAccountMomos)->where('sdt', $account->sdt)->first();
$account->game = $account->getGameAttribute();
if (!is_null($accountMomo)) {
if ($accountMomo['status'] == STATUS_MAINTENANCE) {
$account->text_status = "Bảo trì";
$account->class_status = "warning";
} else {
$account->text_status = "Hoạt động";
$account->class_status = "success";
}
} else {
$account->notExist = "true";
}
return $account;
})->filter(function($account) {
return !isset($account->notExist);
})->toArray();
Cache::put('cache_list_account_momos_active', $levelAccounts, Carbon::now()->addMinutes(60));
return $levelAccounts;
}
public function getListAccountMomos($forCreate = false, $status = [STATUS_ACTIVE])
{
$phones = [];
if (!$forCreate) {
$accountListMomoLevel = $this->getListAccountMomosLevels();
$phones = collect($accountListMomoLevel)->pluck('sdt')->toArray();
}
$query = AccountMomo::whereIn('status', $status);
$query = !$forCreate ? $query->whereIn('sdt', $phones)->limit(5) : $query;
return $query->get()->unique('sdt')->toArray();
}
public function getListAccountMomosWithAccountLevel($groupByType = true)
{
$accounts = collect($this->getListAccountMomosLevels());
$phones = $accounts->pluck('sdt')->unique()->toArray();
$LichSuBank = new LichSuBank;
$LichSuBanks = $LichSuBank->whereDate('created_at', \Illuminate\Support\Carbon::today())->get();
$sumTienCuocPhones = [];
foreach ($phones as $index => $phone) {
$sumTienCuocPhones[] = [
'phone' => $phone,
'sum' => DB::table('lich_su_choi_momos')
->whereDate('created_at', Carbon::today())
->where('ketqua', 1)
->where('sdt_get', $phone)
->sum('tiennhan'),
];
}
$accountMomos = AccountMomo::whereIn('sdt', $phones)
->where('status', STATUS_ACTIVE)
->get();
$phonesAccountMomo = $accountMomos->pluck('sdt')->toArray();
$accounts = $accounts->map(function($account) use ($sumTienCuocPhones, $LichSuBanks, $accountMomos) {
$sumTienCuocPhone = collect($sumTienCuocPhones)->where('phone', $account['sdt'])->first();
$accountMomo = $accountMomos->where('sdt', $account['sdt'])->first();
$account['sumTienCuoc'] = is_null($sumTienCuocPhone) ? 0 : $sumTienCuocPhone['sum'];
$account['gioihan'] = is_null($accountMomo) ? 0 : $accountMomo['gioihan'];
$getLichSuBank = $LichSuBanks->where('sdtbank', $account['sdt']);
$countbank = 0;
$responseLichSuBank = $getLichSuBank->pluck('response')->toArray();
foreach ($responseLichSuBank as $response) {
$j = json_decode($response, true);
if (isset($j['status']) && $j['status'] == 200) {
$countbank++;
}
}
$account['countbank'] = $countbank;
$account['color_min'] = $account['min'] > CONFIG_COMPARE_TIEN_CUOC_MIN ? "blue" : "";
$account['color_max'] = $account['max'] > CONFIG_COMPARE_TIEN_CUOC_MIN ? "blue" : "";
$account['color_tiencuoc'] = $account['sumTienCuoc'] > CONFIG_MAX_SUM_TIEN_CUOC ? "red" : "green";
$account['color_countbank'] = $countbank > CONFIG_MAX_COUNT_BANK ? "red" : "green";
return $account;
})->filter(function($account) use ($phonesAccountMomo) {
return in_array($account['sdt'], $phonesAccountMomo);
})->take(5)->sortBy('min');
return $groupByType ? $accounts->groupBy('type')->map(function($accountList) {
return $accountList->unique('sdt');
}) : $accounts;
}
}

View File

@ -0,0 +1,204 @@
<?php
/**
*File name : AttendanceSessionRepository.php / Date: 10/26/2021 - 9:39 PM
*/
namespace App\Http\Repositories;
use App\Models\AccountMomo;
use App\Models\AttendanceDateSetting;
use App\Models\AttendanceSession;
use App\Models\AttendanceSetting;
use App\Models\LichSuChoiAttendanceDate;
use App\Models\LichSuChoiMomo;
use App\Models\Setting;
use App\Models\UserAttendanceSession;
use App\Traits\PhoneNumber;
use Carbon\Carbon;
use Illuminate\Config\Repository;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
class AttendanceDateRepository extends Repository
{
public function __construct()
{
}
public function getMocchoi()
{
return AttendanceDateSetting::orderBy('mocchoi')->get()->toArray();
}
public function checkTurOnAttendanceDate()
{
$attendanceRepo = new AttendanceSessionRepository();
$setting = $attendanceRepo->getSettingWebsite();
if (isset($setting['baotri']) && $setting['baotri'] == 1) {
return false;
}
if (!isset($setting['on_diemdanh_ngay'])) {
return true;
}
return $setting['on_diemdanh_ngay'] == TURN_ON_SETTING;
}
public function handleAttendanceDate($data)
{
$attendanceDateRepo = new AttendanceDateRepository();
$phone = (new PhoneNumber)->convert($data['phone']);
$phoneOld = (new PhoneNumber)->convert($data['phone'], true);
$phonesAccount = AccountMomo::where('sdt', $phone)->orWhere('sdt', $phoneOld)->get();
$date = Carbon::today()->toDateString();
$lichSuMomosOfPhone = LichSuChoiMomo::where('sdt', $phone)
->where('created_at', '>=', $date)
->orWhere(function($query) use ($phoneOld, $date) {
$query->where('sdt', $phoneOld)
->where('created_at', '>=', $date);
})
->get();
if (count($lichSuMomosOfPhone) == 0 && count($phonesAccount) == 0) {
return $this->responseResult("Oh !! Số điện thoại này chưa chơi game nào, hãy kiểm tra lại");
}
$mocchois = $attendanceDateRepo->getMocchoi();
$mocchoiFirst = collect($mocchois)->first();
if (count($mocchois) == 0) {
return $this->responseResult("Hệ thống đang bảo trì vui lòng thử lại sau!");
}
$sumTien = $lichSuMomosOfPhone->sum('tiencuoc');
$lichsuChoi = $this->getLichSuChoiDiemDanhNgay($date, $phone, $phoneOld);
if (count($lichsuChoi) == 0) {
if ($sumTien < $mocchoiFirst['mocchoi']) {
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền để nhận thưởng trong ngày hôm nay. Cố gắng chơi thêm nhé!!!");
}
$mocSumTien = collect($mocchois)->where('mocchoi', "<=", $sumTien)->last();
if (is_null($mocSumTien)) {
return $this->responseResult("Hệ thống đang bảo trì vui lòng thử lại sau!");
}
$tiennhan = $mocSumTien['tiennhan'];
$this->insertPhoneToTableLichSu($phoneOld, $mocSumTien['mocchoi'], $tiennhan);
} else {
$mocDaChoiMax = array_key_last($lichsuChoi);
$mocSumTien = collect($mocchois)->where('mocchoi', "<=", $sumTien)->last();
// $mocTiepTheo = collect($mocchois)->where('mocchoi', ">", $mocDaChoiMax)->first();
if (is_null($mocSumTien) || $this->mocchoiIsMax(collect($mocchois)->last(), $mocDaChoiMax)) {
return $this->responseResult("Bạn đã nhận thưởng hết trong ngày hôm nay. Vui lòng quay lại trò chơi vào ngày mai!!!");
}
if ($mocDaChoiMax)
// $mocSumTien['mocchoi'] == $mocDaChoiMax
$mocDatTiepTheo = $mocSumTien['mocchoi'];
if ($mocDaChoiMax == $mocDatTiepTheo){
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền tiếp theo để nhận thưởng thêm trong hôm nay. Cố gắng Pang thêm nhé!!!");
}
if ($sumTien >= $mocDatTiepTheo) {
$tiennhan = $mocSumTien['tiennhan'];
$this->insertPhoneToTableLichSu($phoneOld, $mocDatTiepTheo, $tiennhan);
} else {
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền tiếp theo để nhận thưởng thêm trong hôm nay. Cố gắng Pang thêm nhé!!!");
}
}
return $this->responseResult("Oh!! Chúc mừng bạn đã nhận được ".number_format($tiennhan)." VNĐ ĐỚP ÍT THÔI!!");
}
private function getPhoneAccountMomo()
{
$cache = Cache::get('cache_get_sdt_account_momo');
if (!is_null($cache)) {
return $cache;
}
$account = AccountMomo::orderBy('status')->first();
$phone = $account->sdt;
Cache::put('cache_get_sdt_account_momo', $phone, Carbon::now()->addMinutes(10));
return $phone;
}
private function insertPhoneToTableLichSu($phone, $mocchoi, $tienNhan)
{
$phoneGet = $this->getPhoneAccountMomo();
$billCode = 'Nghiệm vụ ngày '.bin2hex(random_bytes(3)).time();
$this->insertToLichSuMoMo($phone, $tienNhan, $phoneGet, $billCode);
$this->insertToLichSuDiemDanhNgay($phone, $mocchoi, $tienNhan, $phoneGet, $billCode);
}
/**
* @param $phone
* @param $tienNhan
*
* @throws \Exception
*/
private function insertToLichSuMoMo($phone, $tienNhan, $phoneGet, $billCode)
{
return DB::table('lich_su_choi_momos')->insert([
'sdt' => $phone,
'sdt_get' => $phoneGet,
'magiaodich' => $billCode,
'tiencuoc' => 0,
'tiennhan' => $tienNhan,
'trochoi' => "Nghiệm vụ ngày",
'noidung' => "NVN",
'ketqua' => 1,
'status' => STATUS_LSMOMO_TAM_THOI,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]);
}
private function insertToLichSuDiemDanhNgay($phone, $mocchoi, $tienNhan, $phoneGet, $billCode)
{
return DB::table('lich_su_attendance_date')->insert([
'date' => Carbon::today()->toDateString(),
'phone' => $phone,
'mocchoi' => $mocchoi,
'tiennhan' => $tienNhan,
'sdt_get' => $phoneGet,
'magiaodich' => $billCode,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
]);
}
/**
* @return array
*/
private function responseResult($message): array
{
return [
'status' => 2,
'message' => $message,
];
}
/**
* @param string $date
* @param array $phone
*
* @return mixed
*/
private function getLichSuChoiDiemDanhNgay($date, $phone, $phoneOld)
{
$lichsuChoi = LichSuChoiAttendanceDate::whereDate('date', $date)
->where('phone', $phone)
->orWhere(function($query) use ($phoneOld, $date) {
$query->where('phone', $phoneOld)
->whereDate('date', $date);
})
->orderBy("mocchoi")
->get()
->pluck('tiennhan', 'mocchoi')
->toArray();
return $lichsuChoi;
}
public function mocchoiIsMax($mocchoiMax, $mocchoiCheck)
{
return $mocchoiMax['mocchoi'] == $mocchoiCheck;
}
}

View File

@ -0,0 +1,239 @@
<?php
/**
*File name : AttendanceSessionRepository.php / Date: 10/26/2021 - 9:39 PM
*/
namespace App\Http\Repositories;
use App\Models\AttendanceSession;
use App\Models\AttendanceSetting;
use App\Models\Setting;
use App\Models\UserAttendanceSession;
use Carbon\Carbon;
use Illuminate\Config\Repository;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
class AttendanceSessionRepository extends Repository
{
public function __construct()
{
}
public function getSecondsRealtime($updateCache = false)
{
$now = Carbon::now();
$hour = $now->hour;
$setting = $this->getAttendanceSetting();
$timeEach = (int)$setting['time_each'];
$timeStart = $this->getTimeStartByConfigTimeEach($timeEach, $hour, $now);
// $minute = (int)floor($now->minute / 10) * 3;
// $timeStart = Carbon::parse($hour.":".$minute);
// $abc = $now->minute - $now->minute%3;
// dd($hour.":".$abc, $hour.":".(int)floor($now->minute / 10) * 10);
$realTimeSeconds = $timeEach - (int)($now->timestamp - $timeStart->timestamp);
if ($realTimeSeconds <= 1 || $updateCache) {
$this->forgetCacheDatAttendanceSession();
}
return $realTimeSeconds;
}
private function getTimeStartByConfigTimeEach($timeEach, $hour, Carbon $now)
{
switch ($timeEach) {
case 60:
default;
return Carbon::parse($hour.":".$now->minute);
case 180:
$minute = $now->minute - $now->minute % 3;
return Carbon::parse($hour.":".$minute);
case 300:
$minute = $now->minute - $now->minute % 5;
return Carbon::parse($hour.":".$minute);
case 600:
$minute = (int)floor($now->minute / 10) * 10;
return Carbon::parse($hour.":".$minute);
case 900:
$minute = $now->minute - $now->minute % 15;
return Carbon::parse($hour.":".$minute);
case 1200:
$minute = $now->minute - $now->minute % 20;
return Carbon::parse($hour.":".$minute);
case 1800:
$minute = $now->minute - $now->minute % 30;
return Carbon::parse($hour.":".$minute);
case 3600:
return $now->startOfHour();
case 21600:
$hour = $hour - $hour % 6;
return Carbon::parse($hour.":00");
case 86400:
return Carbon::today();
}
}
public function getDataAttendanceSession()
{
$cache = Cache::get('cache_data_attendance_session');
$cache = null;
if (!is_null($cache)) {
return $cache;
}
return $this->updateCacheDataAttendanceSession();
}
public function getCurrentAttendanceSession()
{
return $this->getDataAttendanceSession()['current'];
}
public function getTotalAmountAttendanceSession()
{
$cache = Cache::get('cache_total_amount_attendance_session');
if (!is_null($cache)) {
return $cache;
}
$totalAmount = DB::table('attendance_session')->sum('amount');
Cache::put('cache_total_amount_attendance_session', $totalAmount,
Carbon::now()->addSeconds($this->getSecondsRealtime()));
return $totalAmount;
}
public function getUsersAttendanceSession($attendanceSessionCurrent = null)
{
$attendanceSessionCurrent = !is_null($attendanceSessionCurrent) ? $attendanceSessionCurrent : $this->getDataAttendanceSession()['current'];
return $attendanceSessionCurrent->usersAttendanceSession()->get();
}
public function insertUsersAttendanceSession($data)
{
$attendanceSessionCurrent = $this->getDataAttendanceSession()['current'];
return UserAttendanceSession::create([
'session_id' => $attendanceSessionCurrent->id,
'phone' => $data['phone'],
]);
}
public function queryUsersAttendanceByPhone($phone)
{
$attendanceSessionCurrent = $this->getDataAttendanceSession()['current'];
return UserAttendanceSession::where('phone', $phone)->where('session_id', $attendanceSessionCurrent->id)->get();
}
public function createNewAttendanceSession($currentAttendanceSession)
{
$currentAttendanceSession->update(['status' => STATUS_DE_ACTIVE]);
$attendanceSession = AttendanceSession::create([
'date' => Carbon::today()->toDateString(),
'status' => STATUS_ACTIVE,
]);
$this->forgetCacheDatAttendanceSession();
return $attendanceSession;
}
public function getPhoneAttendanceSessionBots()
{
$cache = Cache::get('cache_phone_attendance_session_bots');
if (!is_null($cache)) {
return $cache;
}
$phones = collect(DB::table('attendance_session_bots')->select('phone')->get());
$phones = $phones->pluck('phone')->toArray();
Cache::put('cache_phone_attendance_session_bots', $phones, Carbon::now()->addDay());
return $phones;
}
public function getRandomBotsAttendance($botRate = 10, $phoneUserAttendance = [])
{
$totalBot = count(DB::table('attendance_session_bots')->get());
return DB::table('attendance_session_bots')
->whereNotIn('phone', $phoneUserAttendance)
->orderBy(DB::raw('RAND()'))
->take(round(($botRate / 100) * $totalBot))
->get();
}
public function checkTurOnAttendance()
{
$setting = $this->getSettingWebsite();
if (isset($setting['baotri']) && $setting['baotri'] == 1) {
return false;
}
if (!isset($setting['on_diemdanh'])) {
return true;
}
return $setting['on_diemdanh'] == TURN_ON_SETTING;
}
public function getSettingWebsite()
{
$cache = Cache::get('cache_website_setting');
$cache = null;
if (!is_null($cache)) {
return $cache;
}
$setting = Setting::first()->toArray();
Cache::put('cache_website_setting', $setting, Carbon::now()->addDay());
return $setting;
}
/**
* @return array
*/
public function updateCacheDataAttendanceSession()
{
$records = AttendanceSession::where('date', Carbon::today()->toDateString())
->orderBy('created_at', 'DESC')
->with(['usersAttendanceSession'])
->get();
if (count($records) == 0) {
return [
'current' => AttendanceSession::create(['date' => Carbon::today()->toDateString()]),
'phone_win_latest' => "*",
'sessions_past' => collect(),
];
}
$current = $records->where('status', STATUS_ACTIVE)->last();
$current = is_null($current) ? $records->last() : $current;
$sessionsPast = $records->except($current->id)->take(5);
$result = [
'current' => $current,
'phone_win_latest' => count($sessionsPast) > 0 ? $sessionsPast->first()->getPhone() : "*",
'sessions_past' => count($sessionsPast) > 0 ? $sessionsPast : collect(),
];
Cache::put('cache_data_attendance_session', $result, Carbon::now()->addSeconds($this->getSecondsRealtime()));
return $result;
}
public function forgetCacheDatAttendanceSession()
{
Cache::forget('cache_data_attendance_session');
Cache::forget('cache_total_amount_attendance_session');
}
public function getAttendanceSetting()
{
$cache = Cache::get('cache_attendance_setting');
if (!is_null($cache)) {
return $cache;
}
$attendance = AttendanceSetting::first();
$config = !is_null($attendance) ? AttendanceSetting::first()->toArray() : AttendanceSetting::create([
'win_rate' => 10,
'start_time' => TIME_START_ATTENDANCE,
'end_time' => TIME_END_ATTENDANCE,
'money_min' => MONEY_MIN_WIN_ATTENDANCE,
'money_max' => MONEY_MAX_WIN_ATTENDANCE,
'time_each' => TIME_EACH_ATTENDANCE_SESSION,
])->toArray();
Cache::put('cache_attendance_setting', $config, Carbon::now()->addDay());
return $config;
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AdminSettingGameRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'min' => 'required|integer',
'max' => 'required|integer',
'sdt' => 'required',
'tile' => 'required',
];
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AdminSettingGameRequest2 extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'min' => 'required|integer',
'max' => 'required|integer',
'sdt' => 'required',
'tile1' => 'required',
'tile2' => 'required',
'tile3' => 'required',
];
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AdminSettingGameRequest3 extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'tiencuoc' => 'required|integer',
'tienmacdinh' => 'required|integer',
'ptvaohu' => 'required|integer',
];
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ChangePasswordAdminRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'old_password' => 'required',
'password' => 'required|string|min:6|confirmed',
];
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CronMomoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'account_id' => 'integer|min:1|required',
];
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class LoginAdminRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
'email' => 'required|email',
'password' => 'required',
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;
class AccountLevelMoney extends Model
{
use HasFactory;
protected $table = "account_level_money";
protected $fillable = [
'sdt',
'type',
'min',
'max',
];
public function getGameAttribute()
{
$games = Config::get('constant.list_game');
return $games[$this->type] ?? '';
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AccountMomo extends Model
{
use HasFactory;
protected $fillable = [
'sdt',
'password',
'token',
'status',
'gioihan',
'webapi'
];
protected $hidden = [
'password',
'token',
];
public function TextStatus($status){
if ($status == 1) {
return 'Hoạt động';
}
if ($status == 2) {
return 'Đang bảo trì';
}
}
public function ClassStatus($status){
if ($status == 1) {
return 'success';
}
if ($status == 2) {
return 'danger';
}
}
public function GetListAccountID($id){
$id='';
$AccountMomo = new AccountMomo;
$ListAccount = $AccountMomo->get();
foreach ($ListAccount as $row) {
$id=$id .$row->id.',';
}
$list_id = explode(',', $id);
$data = [];
$dem = 0;
foreach($list_id as $row){
$res = $this->where([
'id' => $row,
'status' => 1,
]);
if ($res->count() > 0) {
$response = $res->first()->sdt;
$data[$dem] = $response;
$dem++;
}
}
return $data;
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class AttendanceDateSetting extends Model
{
use HasFactory, SoftDeletes;
protected $table = "attendance_date_setting";
protected $fillable = [
'mocchoi',
'tiennhan',
];
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AttendanceSession extends Model
{
use HasFactory;
protected $table = "attendance_session";
protected $fillable = [
'phone',
'date',
'amount',
'bill_code',
'status',
];
public function getPhone()
{
$middle_string = "";
$length = strlen($this->phone);
if ($length < 3) {
return $length == 1 ? "*" : "*".substr($this->phone, -1);
} else {
$part_size = floor($length / 3);
$middle_part_size = $length - ($part_size * 2);
for ($i = 0; $i < $middle_part_size; $i++) {
$middle_string .= "*";
}
return substr($this->phone, 0, $part_size).$middle_string.substr($this->phone, -$part_size);
}
}
public function usersAttendanceSession()
{
return $this->hasMany(UserAttendanceSession::class, 'session_id');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AttendanceSetting extends Model
{
use HasFactory;
protected $table ="attendance_settings";
protected $fillable = [
'win_rate',
'bot_rate',
'start_time',
'end_time',
'money_min',
'money_max',
'time_each',
'setphonewin'
];
}

11
app/Models/Cache.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Cache extends Model
{
use HasFactory;
}

18
app/Models/ChanLe.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ChanLe extends Model
{
use HasFactory;
protected $fillable = [
'min',
'max',
'sdt',
'tile'
];
}

11
app/Models/ChanLe2.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ChanLe2 extends Model
{
use HasFactory;
}

View File

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

20
app/Models/Gap3.php Normal file
View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Gap3 extends Model
{
use HasFactory;
protected $fillable = [
'min',
'max',
'sdt',
'tile1',
'tile2',
'tile3'
];
}

11
app/Models/LichSuBank.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LichSuBank extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LichSuChoiAttendanceDate extends Model
{
protected $table = "lich_su_attendance_date";
use HasFactory;
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LichSuChoiMomo extends Model
{
use HasFactory;
public function getSdtHiddenAttribute()
{
$middle_string = "";
$length = strlen($this->sdt);
if ($length < 3) {
return $length == 1 ? "*" : "*".substr($this->sdt, -1);
} else {
$part_size = floor($length / 3);
$middle_part_size = $length - ($part_size * 2);
for ($i = 0; $i < $middle_part_size; $i++) {
$middle_string .= "*";
}
return substr($this->sdt, 0, $part_size).$middle_string.substr($this->sdt, -$part_size);
}
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LichSuChoiNoHu extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LichSuTraThuongTuan extends Model
{
use HasFactory;
}

11
app/Models/LimitCron.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LimitCron extends Model
{
use HasFactory;
}

12
app/Models/MaGiaoDich.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class MaGiaoDich extends Model
{
protected $table = "ma_giao_dichs";
use HasFactory;
}

17
app/Models/NoHuu.php Normal file
View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class NoHuu extends Model
{
use HasFactory;
protected $fillable = [
'tiencuoc',
'tienmacdinh',
'ptvaohu',
];
}

35
app/Models/Setting.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
protected $fillable = [
'title',
'description',
'logo',
'linkvideoyoutube',
'zalo',
'baotri',
'script',
'color_header',
'color_footer',
'color_table',
'color_table2',
'on_chanle',
'on_taixiu',
'on_chanle2',
'on_gap3',
'on_tong3so',
'on_1phan3',
'on_nohu',
'on_trathuongtuan',
'on_diemdanh',
'on_diemdanh_ngay'
];
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SettingPhanThuongTop extends Model
{
use HasFactory;
}

18
app/Models/TaiXiu.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TaiXiu extends Model
{
use HasFactory;
protected $fillable = [
'min',
'max',
'sdt',
'tile'
];
}

11
app/Models/Tong3So.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Tong3So extends Model
{
use HasFactory;
}

12
app/Models/TopTuan.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TopTuan extends Model
{
protected $table = "top_tuan";
use HasFactory;
}

43
app/Models/User.php Normal file
View File

@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserAttendanceSession extends Model
{
use HasFactory;
protected $table = "users_attendance_session";
protected $fillable = [
'session_id',
'user_id',
'phone',
'status',
];
public function getPhone()
{
$middle_string = "";
$length = strlen($this->phone);
if ($length < 3) {
return $length == 1 ? "*" : "*".substr($this->phone, -1);
} else {
$part_size = floor($length / 3);
$middle_part_size = $length - ($part_size * 2);
for ($i = 0; $i < $middle_part_size; $i++) {
$middle_string .= "*";
}
return substr($this->phone, 0, $part_size).$middle_string.substr($this->phone, -$part_size);
}
}
}

128
app/Models/WEB2M.php Normal file
View File

@ -0,0 +1,128 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Http;
use App\Models\AccountMomo;
use App\Models\LichSuBank;
class WEB2M extends AccountMomo
{
//Lấy lịch sử giao dịch
public function GetGiaoDich($token,$webapi){
if($webapi == 1 ){
$url = "https://nguyenkhoa.dichvuapi.com/historyapimomo1h/$token";
}
else{
//$url = "https://thueapimomo.vn/HISTORYAPIMOMOVIP?token=$token&time=1";https://apiv3.web2m.com
$url = "https://apiv3.web2m.com/historyapimomo1h/$token";
}
$response = Http::get($url);
return $response->json();
}
//Chuyển tiền MOMO
public function Bank($token, $sdtnguoinhan, $password, $money, $noidung,$webapi){
//$url = "https://api.web2m.com/TRANSFERAPIMOMO/$token/$sdtnguoinhan/$password/$money/$noidung";
if($webapi == 1 ){
$url = "https://nguyenkhoa.dichvuapi.com/TRANSFERAPIMOMO/$token/$sdtnguoinhan/$password/$money/$noidung";
}
else{
//$url = "https://thueapimomo.vn/TRANSFERAPIMOMO?token=$token&phone=$sdtnguoinhan&cash=$money&comment=$noidung&passmomo=$password";
$url = "https://apiv3.web2m.com/TRANSFERAPIMOMO/$token/$sdtnguoinhan/$password/$money/$noidung";
}
$response = Http::get($url);
$AccountMomo = new AccountMomo;
$getInfoPhone = $AccountMomo->where([
'token' => $token
])->first();
$LichSuBank = new LichSuBank;
$LichSuBank->sdtbank = $getInfoPhone->sdt;
$LichSuBank->nguoinhan = $sdtnguoinhan;
$LichSuBank->sotien = $money;
$LichSuBank->noidung = $noidung;
$LichSuBank->response = json_encode($response->json() ?? []);
$LichSuBank->save();
return $response->json();
}
public function getMoney_momo($token,$webapi)
{
try {
//$result = Http::get("https://api.web2m.com/apigetsodu/$token")->json();
if($webapi == 1 ){
$result = Http::get("https://nguyenkhoa.dichvuapi.com/apigetsodu/$token")->json();
}
else{
//$result = Http::get("https://thueapimomo.vn/GETBALANCEAPIMOMO?token=$token")->json();
$result = Http::get("https://apiv3.web2m.com/apigetsodu/$token")->json();
}
//if($webapi == 1 ){
if(true){
if(isset($result['status']) && $result['status'] == 200){
return $result['SoDu'];
}else
{
return 0;
}
}
else{
if(isset($result['status']) && $result['status'] == 'success'){
return $result['balance'];
}else
{
return 0;
}
}
}
catch(Exception $e) {
return 0;
}
}
public function getName_momo($sdt, $token, $webapi)
{
try {
//$result = Http::get("https://api.web2m.com/apigetten/".$sdt."/".$token)->json();
if($webapi == 1 ){
$result = Http::get("https://nguyenkhoa.dichvuapi.com/apigetten/".$sdt."/".$token)->json();
}
else{
$result = Http::get("https://apiv3.web2m.com/apigetten/".$sdt."/".$token)->json();
// $result = Http::get("https://thueapimomo.vn/GETNAMEAPIMOMO?token=$token&phone=$sdt")->json();
}
if(isset($result['status']) && $result['status'] == 200)
{
return $result['name'];
}
else
{
if( !empty($result['msg']) ){
return $result['msg'];
} else {
return 'Có lỗi xãy ra vui lòng F5';
}
}
}
catch(Exception $e) {
return 'Có lỗi xãy ra vui lòng thử lại';
}
}
}

85
app/Models/WEB2Mbk.php Normal file
View File

@ -0,0 +1,85 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Http;
use App\Models\AccountMomo;
use App\Models\LichSuBank;
class WEB2M extends AccountMomo
{
//Lấy lịch sử giao dịch
public function GetGiaoDich($token){
$url = "https://api.web2m.com/historyapimomo1h/$token";
$response = Http::get($url);
return $response->json();
}
//Chuyển tiền MOMO
public function Bank($token, $sdtnguoinhan, $password, $money, $noidung){
$url = "https://api.web2m.com/TRANSFERAPIMOMO/$token/$sdtnguoinhan/$password/$money/$noidung";
$response = Http::get($url);
$AccountMomo = new AccountMomo;
$getInfoPhone = $AccountMomo->where([
'token' => $token
])->first();
$LichSuBank = new LichSuBank;
$LichSuBank->sdtbank = $getInfoPhone->sdt;
$LichSuBank->nguoinhan = $sdtnguoinhan;
$LichSuBank->sotien = $money;
$LichSuBank->noidung = $noidung;
$LichSuBank->response = json_encode($response->json() ?? []);
$LichSuBank->save();
return $response->json();
}
public function getMoney_momo($token)
{
try {
$result = Http::get("https://api.web2m.com/apigetsodu/$token")->json();
if(isset($result['status']) && $result['status'] == 200)
{
return $result['SoDu'];
}
else
{
return 0;
}
}
catch(Exception $e) {
return 0;
}
}
public function getName_momo($sdt, $token)
{
try {
$result = Http::get("https://api.web2m.com/apigetten/".$sdt."/".$token)->json();
if(isset($result['status']) && $result['status'] == 200)
{
return $result['name'];
}
else
{
if( !empty($result['msg']) ){
return $result['msg'];
} else {
return 'Có lỗi xãy ra vui lòng F5';
}
}
}
catch(Exception $e) {
return 'Có lỗi xãy ra vui lòng thử lại';
}
}
}

11
app/Models/X1Phan3.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class X1Phan3 extends Model
{
use HasFactory;
}

View File

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

View File

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\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\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

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

View File

@ -0,0 +1,32 @@
<?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()
{
//
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

165
app/Traits/PhoneNumber.php Normal file
View File

@ -0,0 +1,165 @@
<?php
/**
*File name : PhoneNumber.php / Date: 10/27/2021 - 11:26 PM
*/
namespace App\Traits;
class PhoneNumber
{
//private $phonetype='CELL'; //CELL, HOME
private $arr_Prefix = [
'CELL' => [
'016966' => '03966',
'0169' => '039',
'0168' => '038',
'0167' => '037',
'0166' => '036',
'0165' => '035',
'0164' => '034',
'0163' => '033',
'0162' => '032',
'0120' => '070',
'0121' => '079',
'0122' => '077',
'0126' => '076',
'0128' => '078',
'0123' => '083',
'0124' => '084',
'0125' => '085',
'0127' => '081',
'0129' => '082',
'01992' => '059',
'01993' => '059',
'01998' => '059',
'01999' => '059',
'0186' => '056',
'0188' => '058',
],
// 'HOME' => [
// '076' => '0296',
// '064' => '0254',
// '0281' => '0209',
// '0240' => '0204',
// '0781' => '0291',
// '0241' => '0222',
// '075' => '0275',
// '056' => '0256',
// '0650' => '0274',
// '0651' => '0271',
// '062' => '0252',
// '0780' => '0290',
// '0710' => '0292',
// '026' => '0206',
// '0511' => '0236',
// '0500' => '0262',
// '0501' => '0261',
// '0230' => '0215',
// '061' => '0251',
// '067' => '0277',
// '059' => '0269',
// '0351' => '0226',
// '04' => '024',
// '039' => '0239',
// '0320' => '0220',
// '031' => '0225',
// '0711' => '0293',
// '08' => '028',
// '0321' => '0221',
// '058' => '0258',
// '077' => '0297',
// '060' => '0260',
// '0231' => '0213',
// '063' => '0263',
// '025' => '0205',
// '020' => '0214',
// '072' => '0272',
// '0350' => '0228',
// '038' => '0238',
// '030' => '0229',
// '068' => '0259',
// '057' => '0257',
// '052' => '0232',
// '0510' => '0235',
// '055' => '0255',
// '033' => '0203',
// '053' => '0233',
// '079' => '0299',
// '022' => '0212',
// '066' => '0276',
// '036' => '0227',
// '0280' => '0208',
// '037' => '0237',
// '054' => '0234',
// '073' => '0273',
// '074' => '0294',
// '027' => '0207',
// '070' => '0270',
// '029' => '0216',
// ],
];
function convert($phonenumber, $convertOld = false)
{
if (!empty($phonenumber)) {
//1. Xóa ký tự trắng
$phonenumber = str_replace(' ', '', $phonenumber);
//2. Xóa các dấu chấm phân cách
$phonenumber = str_replace('.', '', $phonenumber);
//3. Xóa các dấu gạch nối phân cách
$phonenumber = str_replace('-', '', $phonenumber);
//4. Xóa dấu mở ngoặc đơn
$phonenumber = str_replace('(', '', $phonenumber);
//5. Xóa dấu đóng ngoặc đơn
$phonenumber = str_replace(')', '', $phonenumber);
//6. Xóa dấu +
$phonenumber = str_replace('+', '', $phonenumber);
//7. Chuyển 84 đầu thành 0
if (substr($phonenumber, 0, 2) == '84') {
$phonenumber = '0'.substr($phonenumber, 2, strlen($phonenumber) - 2);
}
$dathaythe = false;
// foreach ($this->arr_Prefix['HOME'] as $key => $value) {
// //$prefixlen=strlen($key);
// dd($key);
// if (strpos($phonenumber, $key) === 0) {
// $prefix = $key;
// $prefixlen = strlen($key);
// $phone = substr($phonenumber, $prefixlen, strlen($phonenumber) - $prefixlen);
// $prefix = str_replace($key, $value, $prefix);
// $phonenumber = $prefix.$phone;
// dd($phonenumber);
// //$phonenumber=str_replace($key,$value,$phonenumber);
// $dathaythe = true;
// break;
// }
// }
if ($dathaythe == false) {
$arrayPrefix = $convertOld ? array_flip($this->arr_Prefix['CELL']) : $this->arr_Prefix['CELL'];
foreach ($arrayPrefix as $key => $value) {
//$prefixlen=strlen($key);
if (strpos($phonenumber, $key) === 0) {
$prefix = $key;
$prefixlen = strlen($key);
$phone = substr($phonenumber, $prefixlen, strlen($phonenumber) - $prefixlen);
$prefix = str_replace($key, $value, $prefix);
$phonenumber = $prefix.$phone;
//$phonenumber=str_replace($key,$value,$phonenumber);
$dathaythe = true;
break;
}
}
}
return $phonenumber;
} else {
return false;
}
}
}

53
artisan Normal file
View File

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

55
bootstrap/app.php Normal file
View File

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

2
bootstrap/cache/.gitignore vendored Normal file
View File

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

63
composer.json Normal file
View File

@ -0,0 +1,63 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"ext-json": "*",
"buihuycuong/vnfaker": "dev-master",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^8.40",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.2",
"studio/laravel-totem": "^8.3"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

7472
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

234
config/app.php Normal file
View File

@ -0,0 +1,234 @@
<?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', 'Chẵn lẻ Momo V2 - ID Thiên Ân'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Ho_Chi_Minh',
/*
|--------------------------------------------------------------------------
| 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' => 'vi',
/*
|--------------------------------------------------------------------------
| 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,
// Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'Date' => Illuminate\Support\Facades\Date::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'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,
],
];

View File

@ -0,0 +1,19 @@
<?php
/**
*File name : attendance_session.php / Date: 11/3/2021 - 9:32 PM
*/
return [
'time_each' => [60, 180, 300, 600, 900, 1200, 1800, 3600, 21600, 86400],
// 'formula_second_real_time' => [
// 60=> ,
// 180=> ,
// 300=> ,
// 600=> ,
// 1800=> ,
// 3600=> ,
// 21600=> ,
// 86400=> ,
// ],
];

117
config/auth.php Normal file
View File

@ -0,0 +1,117 @@
<?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\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that 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,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

64
config/broadcasting.php Normal file
View File

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

110
config/cache.php Normal file
View File

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

55
config/constant.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/**
*File name : constant.php / Date: 10/26/2021 - 9:51 PM
*/
define("STATUS_ACTIVE", 1);
define("STATUS_DE_ACTIVE", 0);
define("STATUS_MAINTENANCE", 2);
define("TURN_ON_SETTING", 1);
define("TURN_OFF_SETTING", 2);
define("TIME_EACH_ATTENDANCE_SESSION", 600);
define("TIME_REFRESH_LOAD_DATA_AFTER", 45);
define("CONFIG_LIMIT_LAN_BANK", 190);
define("TIME_START_ATTENDANCE", "07:00");
define("TIME_END_ATTENDANCE", "23:59");
define("MONEY_MIN_WIN_ATTENDANCE", 5000);
define("MONEY_MAX_WIN_ATTENDANCE", 100000);
define("TIME_CACHE_LOAD_DATA", 20);
define("ATTENDANCE_WIN_RATE_DEFAULT", 4);
define("STATUS_LSMOMO_CHUA_THANH_TOAN", 4);
define("STATUS_LSMOMO_TAM_THOI", 4);
define("CONFIG_ALL_GAME", 0);
define("CONFIG_CHAN_LE", 1);
define("CONFIG_TAI_XIU", 2);
define("CONFIG_CHAN_LE_TAI_XIU_2", 3);
define("CONFIG_GAP_3", 4);
define("CONFIG_TONG_3_SO", 5);
define("CONFIG_1_PHAN_3", 6);
define("CONFIG_GAME_LO", 7);
define('CONFIG_MAX_SUM_TIEN_CUOC', 27000000);
define('CONFIG_MAX_COUNT_BANK', 180);
define('CONFIG_COMPARE_TIEN_CUOC_MIN', 20000);
return [
'list_game' => [
CONFIG_ALL_GAME => "Tất cả",
CONFIG_CHAN_LE => "Chẵn lẻ",
CONFIG_TAI_XIU => "Tài xỉu",
CONFIG_CHAN_LE_TAI_XIU_2 => "Chẵn lẻ tài xỉu 2",
CONFIG_GAP_3 => "Gấp 3",
CONFIG_TONG_3_SO => "Tổng 3 số",
CONFIG_1_PHAN_3 => "1 phần 3",
CONFIG_GAME_LO => "",
],
];

34
config/cors.php Normal file
View File

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

125
config/database.php Normal file
View File

@ -0,0 +1,125 @@
<?php
use Illuminate\Support\Str;
return [
'default' => 'mysql',
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'clmm'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'clmm'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'clmm'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => 'localhost',
'database' => 'clmm',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'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' => [
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'bqmijgfd_mmvip2021',
'username' => 'bqmijgfd_mmvip2021',
'password' => 'bqmijgfd_mmvip2021',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],
'cache' => [
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'bqmijgfd_mmvip2021',
'username' => 'bqmijgfd_mmvip2021',
'password' => 'bqmijgfd_mmvip2021',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],
],
];

72
config/filesystems.php Normal file
View File

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

52
config/hashing.php Normal file
View File

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

105
config/logging.php Normal file
View File

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

110
config/mail.php Normal file
View File

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

93
config/queue.php Normal file
View File

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

33
config/services.php Normal file
View 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'),
],
];

201
config/session.php Normal file
View File

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

36
config/view.php Normal file
View File

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

1
database/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,47 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}

View 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->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
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');
}
}

View File

@ -0,0 +1,36 @@
<?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->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTaiXiusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tai_xius', function (Blueprint $table) {
$table->id();
$table->integer('min');
$table->integer('max');
$table->string('sdt');
$table->double('tile');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tai_xius');
}
}

View File

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->string('description')->nullable();
$table->string('logo')->nullable();;
$table->string('linkvideoyoutube')->nullable();
$table->string('zalo')->nullable();
$table->string('script')->nullable();
$table->integer('baotri');
$table->string('color_header');
$table->string('color_footer');
$table->string('color_table');
$table->string('color_table2');
$table->integer('on_chanle');
$table->integer('on_taixiu');
$table->integer('on_chanle2');
$table->integer('on_gap3');
$table->integer('on_tong3so');
$table->integer('on_1phan3');
$table->integer('on_nohu');
$table->integer('on_trathuongtuan');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateChanLesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chan_les', function (Blueprint $table) {
$table->id();
$table->integer('min');
$table->integer('max');
$table->string('sdt');
$table->double('tile');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chan_les');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateChanLe2sTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('chan_le2s', function (Blueprint $table) {
$table->id();
$table->integer('min');
$table->integer('max');
$table->string('sdt');
$table->double('tile');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('chan_le2s');
}
}

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