first commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
@@ -0,0 +1,68 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=app
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=password
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
KAVE_API_KEY=
|
||||
GOOGLE_CLIENT_ID=
|
||||
GOOGLE_CLIENT_SECRET=
|
||||
GOOGLE_REDIRECT=
|
||||
|
||||
FILESYSTEM_CLOUD=google
|
||||
GOOGLE_DRIVE_CLIENT_ID=
|
||||
GOOGLE_DRIVE_CLIENT_SECRET=
|
||||
GOOGLE_DRIVE_REFRESH_TOKEN=
|
||||
GOOGLE_DRIVE_FOLDER=
|
||||
@@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
/storage/app/*.json
|
||||
@@ -0,0 +1,9 @@
|
||||
# This configuration file was automatically generated by Gitpod.
|
||||
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
|
||||
# and commit this file to your remote git repository to share the goodness with others.
|
||||
|
||||
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
|
||||
|
||||
tasks:
|
||||
- init: cp deploy/.env.example deploy/.env && cp .env.example .env
|
||||
command: bash deploy/gitpod.sh
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FROM webdevops/php-nginx:8.1
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
ENV WEB_DOCUMENT_ROOT /app/public
|
||||
ENV APP_ENV production
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN composer install --no-interaction --optimize-autoloader --no-dev
|
||||
|
||||
RUN php artisan storage:link
|
||||
RUN php artisan optimize
|
||||
|
||||
RUN chown -R application:application .
|
||||
@@ -0,0 +1,66 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\SendSMSJob;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class NotifySubEnd extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:notify-sub-end';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
User::with([
|
||||
'products' => fn ($q) => $q->whereNotIn('gateway', [Transaction::GATEWAYS['cafe'], Transaction::GATEWAYS['myket']])->whereDate('expire_at', now()->subDay()),
|
||||
'products.packageName',
|
||||
])->whereHas('products', fn ($q) => $q->whereDate('expire_at', now()->subDay()))->chunkById(300, function ($users) {
|
||||
foreach ($users as $user) {
|
||||
$link = config('redirects.' . str_replace('.', '*', $user->products[0]->packageName->name));
|
||||
dump($user->mobile);
|
||||
SendSMSJob::dispatch([
|
||||
'mobile' => $user->mobile,
|
||||
'message' => "کاربرعزیز
|
||||
اشتراک برنامه {$user->products[0]->packageName->title} برای شما به پایان رسید
|
||||
برای تمدید کلیک کنید
|
||||
$link"
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Reminder;
|
||||
use App\Jobs\SendPushJob;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SendDueReminders extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*/
|
||||
protected $signature = 'reminders:send-due';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*/
|
||||
protected $description = 'Send push notifications for due reminders';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$now = now();
|
||||
$yesterday = now()->subDay();
|
||||
|
||||
$reminders = Reminder::with(['user', 'packageName'])->where(function ($query) use ($now) {
|
||||
$query->where('repeatable', false)
|
||||
->where('time', '<=', $now)
|
||||
->whereNull('last_repeat');
|
||||
})
|
||||
->orWhere(function ($query) use ($now, $yesterday) {
|
||||
$query->where('repeatable', true)
|
||||
->where('time', '<=', $now)
|
||||
->where(function ($sub) use ($now, $yesterday) {
|
||||
$sub->whereNull('last_repeat')
|
||||
->orWhere('last_repeat', '<=', $yesterday);
|
||||
});
|
||||
})
|
||||
->get();
|
||||
|
||||
if ($reminders->isEmpty()) {
|
||||
$this->info('No reminders due at this time.');
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
foreach ($reminders as $reminder) {
|
||||
$user = $reminder->user;
|
||||
$packageName = $reminder->packageName;
|
||||
|
||||
if ($reminder->last_repeat?->addDays($reminder->repeat_days)->isFuture()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SendPushJob::dispatch(
|
||||
user: $user,
|
||||
title: $reminder->title,
|
||||
packageName: $packageName,
|
||||
description: $reminder->description ?? '',
|
||||
data: $reminder->data ?? []
|
||||
);
|
||||
|
||||
$reminder->last_repeat = $now;
|
||||
$reminder->save();
|
||||
|
||||
$this->info("Queued push notification for reminder {$reminder->id}.");
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class MobileNumberHelper
|
||||
{
|
||||
public static function trim($mobileNumber)
|
||||
{
|
||||
$mobileNumber = (string) str_replace(" ", "", $mobileNumber);
|
||||
|
||||
if (strlen($mobileNumber) < 10) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (strlen($mobileNumber) == 10) {
|
||||
$mobileNumber = '+98' . $mobileNumber;
|
||||
} elseif (strlen($mobileNumber) == 11) {
|
||||
$mobileNumber = '+98' . mb_substr($mobileNumber, 1);
|
||||
} else {
|
||||
$mobileNumber = '+' . $mobileNumber;
|
||||
}
|
||||
|
||||
return (string)$mobileNumber;
|
||||
}
|
||||
|
||||
public static function checkTrimmedNumber($mobileNumber)
|
||||
{
|
||||
$subString = substr($mobileNumber, 1);
|
||||
if (strpos($mobileNumber, '+98') == 0 && is_numeric($subString) && strlen($subString) == 12) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function checkMobileNumber($phone)
|
||||
{
|
||||
$pattern = '/(?:^(009809[\d]{9}|00989[\d]{9}|\+9809[\d]{9}|\+989[\d]{9}|989[\d]{9}|9809[\d]{9}|09[\d]{9}|9[\d]{9}))$/';
|
||||
if (!preg_match($pattern, $phone)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function formatMobile($mobile)
|
||||
{
|
||||
if (!self::checkMobileNumber($mobile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$patern = '/(?:^(009809|00989|\+9809|\+989|989|9809))/';
|
||||
|
||||
$mobile = trim(preg_replace($patern, '09', $mobile));
|
||||
|
||||
if ($mobile[0] == 9 && strlen($mobile) == 10) {
|
||||
$mobile = 0 . $mobile;
|
||||
}
|
||||
return $mobile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class RedirectLinkHelper
|
||||
{
|
||||
public static function get($packageName, $platform = null)
|
||||
{
|
||||
$link = config('redirects.' . str_replace('.', '*', $packageName), "https://uzee.ir/$packageName");
|
||||
if ($platform) {
|
||||
$link .= ".$platform";
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\OldPurchase;
|
||||
use App\Models\PackageName;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use App\Rules\MobileNumber;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function users(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'per_page' => 'integer',
|
||||
'mobile' => 'string',
|
||||
'package_name' => 'string',
|
||||
]);
|
||||
|
||||
$users = User::when(isset($data['package_name']), fn ($q) => $q->whereHas('packageNames', fn ($q2) => $q2->where('name', $data['package_name'])))
|
||||
->when(isset($data['mobile']), fn ($q) => $q->where('mobile', $data['mobile']))
|
||||
->paginate($data['per_page'] ?? 30);
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
public function getUserTransactions(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'per_page' => 'integer'
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$transactions = $user->transactions()->paginate($data['per_page'] ?? 30);
|
||||
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
public function getUserStatus(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'package_name' => 'string'
|
||||
]);
|
||||
|
||||
if (isset($data['package_name']) && !$packageName = PackageName::with('products')->where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$user = User::with([
|
||||
'products' => fn ($q) => $q->when(isset($data['package_name']), fn ($q1) => $q1->where('package_name_id', $packageName->id)),
|
||||
'products.packageName'
|
||||
])->where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function getUserStatusV1(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'package_name' => 'string'
|
||||
]);
|
||||
|
||||
$userMobile = $mobile;
|
||||
if (isset($data['package_name']) && !$packageName = PackageName::with('products')
|
||||
->where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!OldPurchase::when(isset($data['package_name']), fn ($q) => $q->where('package_name', $data['package_name']))
|
||||
->where('mobile', preg_replace('/09/', '989', $userMobile, 1))->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user is not paid'
|
||||
], 400);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'user is paid'
|
||||
]);
|
||||
}
|
||||
|
||||
public function subscribeUser(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'product_id' => 'integer|required'
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$product = Product::where('id', $data['product_id'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$product->buy($user);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'subscribed successfuly'
|
||||
]);
|
||||
}
|
||||
|
||||
public function unsubscribeUser(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'product_id' => 'integer|required'
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$product = Product::where('id', $data['product_id'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user->products()->updateExistingPivot($product, ['expire_at' => now()->format('Y-m-d H:i:s')]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'unsubscribed successfuly'
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteUser(Request $request, $mobile)
|
||||
{
|
||||
if (!$user = User::where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'user deleted'
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateUserProfile(Request $request, $mobile)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'first_name' => 'string',
|
||||
'last_name' => 'string',
|
||||
'email' => 'email',
|
||||
'mobile' => [new MobileNumber, 'string'],
|
||||
'avatar' => 'image'
|
||||
]);
|
||||
|
||||
if (!$subjectUser = User::where('mobile', $mobile)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (isset($data['email'])) {
|
||||
$user = User::where('email', $data['email'])->first();
|
||||
if ($user && $data['email'] != $subjectUser->email) {
|
||||
return response()->json([
|
||||
'message' => 'user with given email exists'
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['mobile'])) {
|
||||
$user = User::where('mobile', $data['mobile'])->first();
|
||||
if ($user && $data['mobile'] != $subjectUser->mobile) {
|
||||
return response()->json([
|
||||
'message' => 'user with given email exists'
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['avatar'])) {
|
||||
Storage::disk('public')->put("avatars/$user->uuid.png", file_get_contents($data['avatar']->path()));
|
||||
$data['avatar'] = "storage/avatars/$user->uuid.png";
|
||||
}
|
||||
|
||||
$subjectUser->update($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'user updated'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\RedirectLinkHelper;
|
||||
use App\Models\Transaction;
|
||||
use App\Modules\Gateway\AsanPardakht\AsanPardakhtApi;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AsanPardakhtController extends Controller
|
||||
{
|
||||
public function pay(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'token' => 'string|required',
|
||||
'mobile' => 'string',
|
||||
]);
|
||||
|
||||
return view('ap-form', ['token' => $data['token'], 'mobile' => $data['mobile']]);
|
||||
}
|
||||
|
||||
public function checkTransaction(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'localInvoiceId' => 'string|required',
|
||||
'platform' => 'string'
|
||||
]);
|
||||
|
||||
if (!$transaction = Transaction::with(['product.packageName', 'user'])->where('status', Transaction::STATUSES['pending'])->where('id', $data['localInvoiceId'])->first()) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => '#'
|
||||
]);
|
||||
}
|
||||
$redirectLink = RedirectLinkHelper::get($transaction->product->packageName->name, $data['platform'] ?? null);
|
||||
$response = AsanPardakhtApi::checkTransaction($transaction);
|
||||
|
||||
if (!$response['status']) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => $redirectLink
|
||||
]);
|
||||
}
|
||||
|
||||
$transaction->update(['status' => Transaction::STATUSES['success']]);
|
||||
|
||||
$transaction->product->buy($transaction->user, $transaction['authority'], Transaction::GATEWAYS['asanpardakht']);
|
||||
|
||||
return view('status', [
|
||||
'status' => true,
|
||||
'redirect_link' => $redirectLink
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CafeConfig;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CafeController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return CafeConfig::get();
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'client_id' => 'required|string',
|
||||
'client_secret' => 'required|string',
|
||||
'access_token' => 'required|string',
|
||||
'refresh_token' => 'required|string',
|
||||
]);
|
||||
|
||||
$CafeConfig = CafeConfig::create($data);
|
||||
|
||||
return $CafeConfig;
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'client_id' => 'required|string',
|
||||
'client_secret' => 'required|string',
|
||||
'access_token' => 'required|string',
|
||||
'refresh_token' => 'required|string',
|
||||
]);
|
||||
|
||||
if (!$cafeConfig = CafeConfig::where('id', $id)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'cafe config not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$cafeConfig->update($data);
|
||||
|
||||
return $cafeConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\RedirectLinkHelper;
|
||||
use App\Models\Transaction;
|
||||
use App\Modules\Gateway\Digipay\DigiPayApi;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DigiPayController extends Controller
|
||||
{
|
||||
public function checkTransaction(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'providerId' => 'string|required',
|
||||
'result' => 'string|required',
|
||||
'trackingCode' => 'string|required',
|
||||
'amount' => 'string|required',
|
||||
]);
|
||||
|
||||
if (!$transaction = Transaction::with(['product.packageName', 'user'])->where('uuid', $data['providerId'])->first()) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => '#'
|
||||
]);
|
||||
}
|
||||
|
||||
if ($data['result'] != 'SUCCESS') {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
|
||||
$response = DigiPayApi::checkTransaction($data['trackingCode']);
|
||||
|
||||
if (!$response['status']) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
|
||||
$transaction->update(['status' => Transaction::STATUSES['success']]);
|
||||
|
||||
$transaction->product->buy($transaction->user, $transaction['authority'], Transaction::GATEWAYS['asanpardakht']);
|
||||
|
||||
return view('status', [
|
||||
'status' => true,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\OldPurchase;
|
||||
use App\Models\PackageName;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class OldApprooController extends Controller
|
||||
{
|
||||
|
||||
public function getUserUnConsumedPurchases(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'package_name' => 'string|required'
|
||||
]);
|
||||
|
||||
$userMobile = auth()->user()->mobile;
|
||||
if (!$packageName = PackageName::with('products')->where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!OldPurchase::where('package_name', $data['package_name'])->where('mobile', preg_replace('/09/', '989', $userMobile, 1))->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user is not paid'
|
||||
], 400);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'user is paid'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CafeConfig;
|
||||
use App\Models\PackageName;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PackageNameController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$packageNames = PackageName::get();
|
||||
return $packageNames;
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'name' => 'string|required',
|
||||
'title' => 'string|required',
|
||||
'avatar' => 'image',
|
||||
'v1_identifier' => 'string|nullable',
|
||||
'myket_access_token' => 'string|nullable',
|
||||
'cafe_config_id' => 'integer|nullable',
|
||||
'web_app_url' => 'string|nullable',
|
||||
'tries' => 'integer',
|
||||
]);
|
||||
|
||||
$otherData = $request->validate([
|
||||
'firebase_json' => 'file'
|
||||
]);
|
||||
|
||||
if ($packageName = PackageName::where('name', $data['name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package exists'
|
||||
], 400);
|
||||
}
|
||||
|
||||
if (isset($data['avatar'])) {
|
||||
Storage::disk('public')->put("package-names/{$data['name']}.png", file_get_contents($data['avatar']->path()));
|
||||
$data['image'] = "storage/package-names/{$data['name']}.png";
|
||||
unset($data['avatar']);
|
||||
}
|
||||
|
||||
if (isset($data['cafe_config_id']) && !$CafeConfig = CafeConfig::where('id', $data['cafe_config_id'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'cafe config not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (isset($otherData['firebase_json'])) {
|
||||
$packageName->addMedia($otherData['firebase_json']->path())
|
||||
->usingName($otherData['firebase_json'] ?? '')
|
||||
->usingFileName($otherData['firebase_json']->getClientOriginalName())
|
||||
->toMediaCollection('firebase_json');
|
||||
}
|
||||
|
||||
$packageName = PackageName::create($data);
|
||||
return $packageName;
|
||||
}
|
||||
|
||||
public function update(Request $request, $name)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'title' => 'string|required',
|
||||
'avatar' => 'image',
|
||||
'v1_identifier' => 'string|nullable',
|
||||
'myket_access_token' => 'string|nullable',
|
||||
'cafe_config_id' => 'integer|nullable',
|
||||
'web_app_url' => 'string|nullable',
|
||||
'tries' => 'integer'
|
||||
]);
|
||||
$otherData = $request->validate([
|
||||
'firebase_json' => 'file'
|
||||
]);
|
||||
|
||||
if (isset($data['avatar'])) {
|
||||
Storage::disk('public')->put("package-names/{$name}.png", file_get_contents($data['avatar']->path()));
|
||||
$data['image'] = "storage/package-names/{$name}.png";
|
||||
unset($data['avatar']);
|
||||
}
|
||||
|
||||
if (isset($data['cafe_config_id']) && !$CafeConfig = CafeConfig::where('id', $data['cafe_config_id'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'cafe config not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$packageName = PackageName::where('name', $name)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$packageName->update($data);
|
||||
|
||||
if (isset($otherData['firebase_json'])) {
|
||||
$packageName->addMedia($otherData['firebase_json']->path())
|
||||
->usingName($otherData['firebase_json'] ?? '')
|
||||
->usingFileName($otherData['firebase_json']->getClientOriginalName())
|
||||
->toMediaCollection('firebase_json');
|
||||
}
|
||||
|
||||
return $packageName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\PackageName;
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use App\Services\CafeService;
|
||||
use App\Services\MyketService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
public function index(Request $request, $packageName)
|
||||
{
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
$products = $packageName->products;
|
||||
return $products;
|
||||
}
|
||||
|
||||
public function store(Request $request, $packageName)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'title' => 'string|required',
|
||||
'price' => 'integer|required',
|
||||
'type' => ['integer', Rule::in(Product::TYPES)],
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$product = $packageName->products()->create($data);
|
||||
return $product;
|
||||
}
|
||||
|
||||
public function update(Request $request, $packageName, $productId)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'title' => 'string|required',
|
||||
'price' => 'integer|required',
|
||||
'type' => ['integer', Rule::in(Product::TYPES)],
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$product = Product::where('id', $productId)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$product->update($data);
|
||||
return $product;
|
||||
}
|
||||
|
||||
public function delete($packageName, $productId)
|
||||
{
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageName)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$product = Product::where('id', $productId)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$product->delete();
|
||||
return response()->json([
|
||||
'message' => 'product deleted'
|
||||
]);
|
||||
}
|
||||
|
||||
public function subscribe(Request $request, $packageName, $productId)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'gateway' => 'string|required|in:cafe,myket',
|
||||
'purchase_token' => 'string|required',
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::where('name', $packageName)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
if (!$product = Product::with(['packageName.cafeConfig'])->where('id', $productId)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($data['gateway'] == 'zarinpal') {
|
||||
if (!$transaction = Transaction::where('authority', $data['authority'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'transaction not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($transaction->status == Transaction::STATUSES['consumed']) {
|
||||
return response()->json([
|
||||
'message' => 'already consumed'
|
||||
], 400);
|
||||
}
|
||||
$merchantId = config('zarinpal.merchant_id');
|
||||
$response = Http::retry(3, 100, throw: false)->post(config('zarinpal.url.verify'), [
|
||||
'merchant_id' => $merchantId,
|
||||
'amount' => $product['price'] * 10,
|
||||
'authority' => $data['authority'],
|
||||
]);
|
||||
if ($response['data'] == [] || $response['data']['code'] == 101) {
|
||||
return response()->json([
|
||||
"message" => "failed",
|
||||
"code" => strval($response['errors']['code'] ?? 101),
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['gateway'] == 'cafe') {
|
||||
// $service = new CafeService($product->packageName->cafeConfig);
|
||||
// $purchaseStatus = $service->checkPurchase($product, $data['purchase_token']);
|
||||
// if (!$purchaseStatus['status']) {
|
||||
// return response()->json([
|
||||
// 'message' => $purchaseStatus['message'],
|
||||
// ], 400);
|
||||
// }
|
||||
// $service->consumePurchase($product, $data['purchase_token']);
|
||||
$user->transactions()->create([
|
||||
'amount' => $product->price,
|
||||
'authority' => $data['purchase_token'],
|
||||
'product_id' => $product->id,
|
||||
'status' => Transaction::STATUSES['consumed'],
|
||||
'gateway' => Transaction::GATEWAYS[$data['gateway']],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($data['gateway'] == 'myket') {
|
||||
$service = new MyketService($product->packageName->cafeConfig);
|
||||
$purchaseStatus = $service->checkPurchase($product, $data['purchase_token']);
|
||||
if (!$purchaseStatus['status']) {
|
||||
return response()->json([
|
||||
'message' => $purchaseStatus['message'],
|
||||
], 400);
|
||||
}
|
||||
$user->transactions()->create([
|
||||
'amount' => $product->price,
|
||||
'authority' => $data['purchase_token'],
|
||||
'product_id' => $product->id,
|
||||
'status' => Transaction::STATUSES['consumed'],
|
||||
'gateway' => Transaction::GATEWAYS[$data['gateway']],
|
||||
]);
|
||||
}
|
||||
|
||||
$product->buy($user, $data['purchase_token'], Transaction::GATEWAYS[$data['gateway']]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'subscribed successfuly'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\PackageName;
|
||||
use App\Models\Reminder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ReminderController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$reminders = Reminder::where('user_id', Auth::id())
|
||||
->orderBy('time')
|
||||
->get();
|
||||
|
||||
return response()->json($reminders);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'description' => 'nullable|string|max:500',
|
||||
'time' => 'required|date',
|
||||
'repeatable' => 'boolean',
|
||||
'repeat_days' => 'nullable|integer|min:1',
|
||||
'data' => 'nullable|array',
|
||||
]);
|
||||
$packageNameData = $request->validate([
|
||||
'package_name' => 'required|exists:package_names,name',
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageNameData['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$reminder = Reminder::create([...$data, 'package_name_id' => $packageName->id, 'user_id' => auth()->user()->id]);
|
||||
|
||||
return $reminder;
|
||||
}
|
||||
|
||||
public function show(Reminder $reminder)
|
||||
{
|
||||
$this->authorizeReminder($reminder);
|
||||
|
||||
return response()->json($reminder);
|
||||
}
|
||||
|
||||
public function update(Request $request, Reminder $reminder)
|
||||
{
|
||||
$this->authorizeReminder($reminder);
|
||||
|
||||
$data = $request->validate([
|
||||
'title' => 'sometimes|string|max:255',
|
||||
'description' => 'nullable|string|max:500',
|
||||
'time' => 'sometimes|date',
|
||||
'repeatable' => 'boolean',
|
||||
'repeat_days' => 'nullable|integer|min:1',
|
||||
'data' => 'nullable|array',
|
||||
]);
|
||||
$packageNameData = $request->validate([
|
||||
'package_name' => 'required|exists:package_names,name',
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('products')->where('name', $packageNameData['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$reminder->update([...$data, 'package_name_id' => $packageName->id]);
|
||||
|
||||
return response()->json($reminder);
|
||||
}
|
||||
|
||||
public function destroy(Reminder $reminder)
|
||||
{
|
||||
$this->authorizeReminder($reminder);
|
||||
|
||||
$reminder->delete();
|
||||
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
|
||||
private function authorizeReminder(Reminder $reminder)
|
||||
{
|
||||
if ($reminder->user_id !== Auth::id()) {
|
||||
abort(403, 'Unauthorized action.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use App\Modules\Gateway\AsanPardakht\AsanPardakhtApi;
|
||||
use App\Modules\Gateway\Digipay\DigiPayApi;
|
||||
use App\Modules\Gateway\Zarinpal\ZarinpalApi;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TransactionController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'per_page' => 'integer'
|
||||
]);
|
||||
|
||||
$transactions = auth()->user()->transactions()->paginate($data['per_page'] ?? 30);
|
||||
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
public function getGateway(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'description' => 'required|string',
|
||||
'product_id' => 'nullable|string',
|
||||
'platform' => 'in:mobile,web,bot'
|
||||
]);
|
||||
|
||||
if (isset($data['product_id']) && !$product = Product::where('id', $data['product_id'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'product not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
if ($user->products()->where('products.id', $data['product_id'])->where('type', Product::TYPES['permanent'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'already have product'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$transaction = $user->transactions()->create([
|
||||
'amount' => floor($product->price * 1.1),
|
||||
'product_id' => $data['product_id'],
|
||||
'uuid' => Str::uuid()->toString()
|
||||
]);
|
||||
|
||||
$gateway = Transaction::GATEWAYS['asanpardakht'];
|
||||
$response = AsanPardakhtApi::getGateway($transaction);
|
||||
if (!($response['status'] ?? false)) {
|
||||
$response = ZarinpalApi::getGateway($transaction, $data['description']);
|
||||
$gateway = Transaction::GATEWAYS['zarinpal'];
|
||||
if (!($response['status'] ?? false)) {
|
||||
$response = DigiPayApi::getGateway($transaction);
|
||||
$gateway = Transaction::GATEWAYS['digipay'];
|
||||
if (!($response['status'] ?? false)) {
|
||||
return response()->json(["message" => "failed"], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$transaction->gateway = $gateway;
|
||||
$transaction->authority = $response['data']['authority'];
|
||||
$transaction->save();
|
||||
|
||||
return response()->json([
|
||||
'url' => $response['data']['url']
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\MobileNumberHelper;
|
||||
use App\Jobs\SendSMSJob;
|
||||
use App\Models\PackageName;
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use App\Rules\MobileNumber;
|
||||
use App\Services\CafeService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function login(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'auth' => 'string|required',
|
||||
'password' => 'string|required',
|
||||
'package_name' => 'string|required',
|
||||
'fcm_token' => 'string|nullable'
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::where('name', $data['package_name'])->first()) {
|
||||
return response()->json(['message' => 'package name not found'], 404);
|
||||
}
|
||||
|
||||
$authType = filter_var($data['auth'], FILTER_VALIDATE_EMAIL) ? 'email' : 'mobile';
|
||||
if ($authType == 'mobile') {
|
||||
$data['auth'] = MobileNumberHelper::formatMobile($data['auth']);
|
||||
}
|
||||
|
||||
$user = User::where($authType, $data['auth'])->first();
|
||||
|
||||
if (!$user || !Hash::check($data['password'], $user->password)) {
|
||||
return response()->json(['message' => 'رمز عبور اشتباه است'], 404);
|
||||
}
|
||||
|
||||
// Attach package if not exists
|
||||
if (!$user->packageNames()->where('package_names.id', $packageName->id)->exists()) {
|
||||
$user->packageNames()->attach($packageName->id, [
|
||||
'tries' => $packageName->tries,
|
||||
'fcm_token' => $data['fcm_token'] ?? null,
|
||||
]);
|
||||
} else {
|
||||
$user->packageNames()->updateExistingPivot($packageName->id, [
|
||||
'fcm_token' => $data['fcm_token'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
$token = $user->createToken('token', $user->is_admin ? ['admin'] : ['user'])->plainTextToken;
|
||||
|
||||
return response()->json([
|
||||
'user' => $user,
|
||||
'token' => $token,
|
||||
]);
|
||||
}
|
||||
public function resendEmailVerification(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
]);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if (!$user) {
|
||||
return response()->json(['message' => 'User not found'], 404);
|
||||
}
|
||||
|
||||
if ($user->email_verified_at) {
|
||||
return response()->json(['message' => 'Email is already verified'], 400);
|
||||
}
|
||||
|
||||
// Generate new code
|
||||
$code = rand(1000, 9999);
|
||||
|
||||
// Delete previous codes
|
||||
\DB::table('email_verifications')->where('user_id', $user->id)->delete();
|
||||
|
||||
// Insert new verification code
|
||||
\DB::table('email_verifications')->insert([
|
||||
'user_id' => $user->id,
|
||||
'code' => $code,
|
||||
'expires_at' => now()->addMinutes(15),
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
// Send email
|
||||
\Mail::to($user->email)->send(new \App\Mail\VerifyEmailCodeMail($code));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Verification email resent successfully'
|
||||
]);
|
||||
}
|
||||
public function register(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'first_name' => 'string|nullable',
|
||||
'last_name' => 'string|nullable',
|
||||
'email' => 'email|required_without:mobile',
|
||||
'password' => 'string|nullable|required_with:email',
|
||||
'mobile' => ['string', new MobileNumber, 'nullable', 'required_without:email'],
|
||||
'fcm_token' => 'string|nullable',
|
||||
'package_name' => 'string|required'
|
||||
]);
|
||||
|
||||
$packageNameValue = $data['package_name'];
|
||||
unset($data['package_name']);
|
||||
|
||||
if (isset($data['mobile'])) {
|
||||
$data['mobile'] = MobileNumberHelper::formatMobile($data['mobile']);
|
||||
if (User::where('mobile', $data['mobile'])->exists()) {
|
||||
return response()->json(['message' => 'Mobile number already exists'], 400);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['email']) && User::where('email', $data['email'])->exists()) {
|
||||
return response()->json(['message' => 'Email already exists'], 400);
|
||||
}
|
||||
|
||||
// ✅ Check if email can receive a message before creating the user
|
||||
if (isset($data['email'])) {
|
||||
$code = rand(1000, 9999);
|
||||
|
||||
try {
|
||||
// Try sending email
|
||||
\Mail::to($data['email'])->send(new \App\Mail\VerifyEmailCodeMail($code));
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'code' => $e->getCode(),
|
||||
'error' => $e->getMessage(),
|
||||
'message' => 'لطفا آدرس ایمیل خود را بررسی کنید و مجدد تلاش کنید',
|
||||
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Hash password
|
||||
$data['password'] = isset($data['password'])
|
||||
? $data['password']
|
||||
: Str::random(8);
|
||||
|
||||
// Create user only if email sending didn't fail
|
||||
$user = User::create($data);
|
||||
|
||||
// Attach package
|
||||
if ($packageName = PackageName::where('name', $packageNameValue)->first()) {
|
||||
$user->packageNames()->attach($packageName->id, [
|
||||
'tries' => $packageName->tries,
|
||||
'fcm_token' => $data['fcm_token'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
// Save email verification code after user is created
|
||||
if (isset($data['email'])) {
|
||||
\DB::table('email_verifications')->insert([
|
||||
'user_id' => $user->id,
|
||||
'code' => $code,
|
||||
'expires_at' => now()->addMinutes(15),
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
// Create token
|
||||
$token = $user->createToken('token', $user->is_admin ? ['admin'] : ['user'])->plainTextToken;
|
||||
|
||||
return response()->json([
|
||||
'message' => 'User registered successfully.',
|
||||
'user' => $user,
|
||||
'token' => $token
|
||||
]);
|
||||
}
|
||||
public function verifyEmailCode(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
'code' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
if (!$user) {
|
||||
return response()->json(['message' => 'User not found'], 404);
|
||||
}
|
||||
|
||||
$record = \DB::table('email_verifications')
|
||||
->where('user_id', $user->id)
|
||||
->where('code', $request->code)
|
||||
->where('expires_at', '>', now())
|
||||
->first();
|
||||
|
||||
if (!$record) {
|
||||
return response()->json(['message' => 'Invalid or expired code'], 400);
|
||||
}
|
||||
|
||||
// Mark email as verified
|
||||
$user->update(['email_verified_at' => now()]);
|
||||
|
||||
// Delete verification record
|
||||
\DB::table('email_verifications')->where('id', $record->id)->delete();
|
||||
$token = $user->createToken('token', $user->is_admin ? ['admin'] : ['user'])->plainTextToken;
|
||||
return response()->json(['message' => 'Email verified successfully', 'token' => $token]);
|
||||
}
|
||||
public function loginOTP(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'mobile' => ['string', new MobileNumber, 'required'],
|
||||
'package_name' => 'string|required',
|
||||
'source' => [Rule::in(PackageName::SOURCES), 'integer'],
|
||||
'fcm_token' => 'string',
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (!$user = User::where('mobile', $data['mobile'])->first()) {
|
||||
$user = User::create([
|
||||
'mobile' => MobileNumberHelper::formatMobile($data['mobile']),
|
||||
'password' => config('app.default_password'),
|
||||
]);
|
||||
}
|
||||
if ($data['mobile'] != config('approo.admin_mobile')) {
|
||||
$otpToken = rand(pow(10, 4), pow(10, 5) - 1);
|
||||
$user->otpTokens()->create([
|
||||
'token' => $otpToken
|
||||
]);
|
||||
|
||||
$verify = Str::random(8);
|
||||
SendSMSJob::dispatch([
|
||||
'mobile' => $data['mobile'],
|
||||
'message' => "کد ورود به برنامه: $otpToken
|
||||
@{$packageName->web_app_url} #$otpToken
|
||||
لغو 11"
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$user->packageNames()->where('package_names.id', $packageName->id)->exists()) {
|
||||
$user->packageNames()->attach($packageName->id, [
|
||||
'tries' => $packageName->tries,
|
||||
'source' => $data['source'] ?? 0,
|
||||
'fcm_token' => $data['fcm_token'] ?? null,
|
||||
]);
|
||||
} else {
|
||||
$user->packageNames()->updateExistingPivot($packageName->id, [
|
||||
'fcm_token' => $data['fcm_token'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'otp sent',
|
||||
'verify_code' => $verify ?? null
|
||||
]);
|
||||
}
|
||||
|
||||
public function checkOTP(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'mobile' => ['string', new MobileNumber, 'required'],
|
||||
'token' => 'string|required',
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $data['mobile'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'user not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$otpToken = $user->otpTokens()->where('token', $data['token'])->where('created_at', '>', now()->subMinutes(15))->first();
|
||||
if (!$otpToken && !($data['mobile'] == config('approo.admin_mobile') && $data['token'] == config('approo.admin_otp'))) {
|
||||
return response()->json([
|
||||
'message' => 'token not valid'
|
||||
], 400);
|
||||
}
|
||||
$otpToken?->delete();
|
||||
|
||||
$token = '';
|
||||
if ($user->is_admin) {
|
||||
$token = $user->createToken('token', ['admin'])->plainTextToken;
|
||||
} else {
|
||||
$token = $user->createToken('token', ['user'])->plainTextToken;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'user' => $user,
|
||||
'token' => $token,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateProfile(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'first_name' => 'string|nullable',
|
||||
'last_name' => 'string|nullable',
|
||||
'birthday' => 'date|nullable',
|
||||
'gender' => ['integer', 'nullable', Rule::in(User::GENDERS)],
|
||||
'email' => 'email|nullable',
|
||||
'mobile' => [new MobileNumber, 'string'],
|
||||
'avatar' => 'image'
|
||||
]);
|
||||
|
||||
if (isset($data['email'])) {
|
||||
$user = User::where('email', $data['email'])->first();
|
||||
if ($user && $data['email'] != auth()->user()->email) {
|
||||
return response()->json([
|
||||
'message' => 'user with given email exists'
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['mobile'])) {
|
||||
$user = User::where('mobile', $data['mobile'])->first();
|
||||
if ($user && $data['mobile'] != auth()->user()->mobile) {
|
||||
return response()->json([
|
||||
'message' => 'user with given email exists'
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
if (isset($data['avatar'])) {
|
||||
Storage::disk('public')->put("avatars/$user->uuid.png", file_get_contents($data['avatar']->path()));
|
||||
$data['avatar'] = "storage/avatars/$user->uuid.png";
|
||||
}
|
||||
|
||||
$user->update($data);
|
||||
|
||||
return response()->json([
|
||||
'user' => $user,
|
||||
'message' => 'user updated'
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$request->user()->currentAccessToken()->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'user logged out'
|
||||
]);
|
||||
}
|
||||
|
||||
public function status(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'package_name' => 'string|required'
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::with('cafeConfig')->where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
if ($user->mobile == config('approo.admin_mobile')) {
|
||||
$user['products'] = Product::where('package_name_id', $packageName->id)->get();
|
||||
} else {
|
||||
// if ($packageName->cafeConfig) {
|
||||
// $user['products'] = $user->products()->where('package_name_id', $packageName->id)->get();
|
||||
// foreach ($user['products'] as $key => $product) {
|
||||
// $service = new CafeService($packageName->cafeConfig);
|
||||
// if ($product->pivot->gateway == Transaction::GATEWAYS['cafe'] && $product->pivot->purchase_token && $product->type != Product::TYPES['permanent']) {
|
||||
// $activeSubscriptions = $service->checkSubscription($product, $product->pivot->purchase_token);
|
||||
// if ($activeSubscriptions) {
|
||||
// $expire = Carbon::createFromTimestamp($activeSubscriptions[0]['validUntilTimestampMsec'] / 1000);
|
||||
// $user->products()->updateExistingPivot($product, ['expire_at' => $expire->format('Y-m-d H:i:s')]);
|
||||
// } else {
|
||||
// $user->products()->updateExistingPivot($product, ['expire_at' => now()->format('Y-m-d H:i:s')]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$user['products'] = $user->products()
|
||||
->where('package_name_id', $packageName->id)
|
||||
->where(fn($q) => $q->where('user_product.expire_at', '>', now()->addHour())->orWhere('user_product.expire_at', null))
|
||||
->get();
|
||||
|
||||
$user['package_name'] = $user->packageNames()
|
||||
->where('package_names.id', $packageName->id)
|
||||
->first();
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function try(Request $request, $name)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if (!$packageName = $user->packageNames()->where('name', $name)->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($packageName->pivot->tries <= 0) {
|
||||
return response()->json([
|
||||
'message' => 'no more tries'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$packageName->pivot->tries->decrement();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success'
|
||||
]);
|
||||
}
|
||||
|
||||
public function googleLogin(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'access_token' => 'string|required',
|
||||
'package_name' => 'string|required',
|
||||
'source' => [Rule::in(PackageName::SOURCES), 'integer']
|
||||
]);
|
||||
|
||||
if (!$packageName = PackageName::where('name', $data['package_name'])->first()) {
|
||||
return response()->json([
|
||||
'message' => 'package name not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$response = Http::get("https://www.googleapis.com/oauth2/v3/userinfo", [
|
||||
'access_token' => $data['access_token']
|
||||
])->json();
|
||||
|
||||
if (!isset($response['email'])) {
|
||||
return response()->json([
|
||||
'message' => 'invalid token'
|
||||
], 400);
|
||||
}
|
||||
if (!$user = User::where('email', $response['email'])->first()) {
|
||||
$user = User::create([
|
||||
'email' => $response['email'],
|
||||
'password' => config('app.default_password'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
if (!$user->packageNames()->where('package_names.id', $packageName->id)->exists()) {
|
||||
$user->packageNames()->attach($packageName->id, [
|
||||
'tries' => $packageName->tries,
|
||||
'source' => $data['source'] ?? 0,
|
||||
]);
|
||||
}
|
||||
|
||||
$token = $user->createToken('token', ['user'])->plainTextToken;
|
||||
|
||||
return response()->json([
|
||||
'user' => $user,
|
||||
'token' => $token,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class WalletController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return response()->json(["wallet" => auth()->user()->wallet ?? 0]);
|
||||
}
|
||||
|
||||
public function charge(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'amount' => 'required|integer',
|
||||
'authority' => 'string|required',
|
||||
]);
|
||||
|
||||
if ($data['authority'] != 'test') {
|
||||
$merchantId = config('zarinpal.merchant_id');
|
||||
$response = Http::retry(3, 100, throw: false)->post(config('zarinpal.url.verify'), [
|
||||
'merchant_id' => $merchantId,
|
||||
'amount' => $data['amount'] * 10,
|
||||
'authority' => $data['authority'],
|
||||
]);
|
||||
if ($response['data'] == [] || $response['data']['code'] == 101) {
|
||||
return response()->json([
|
||||
"message" => "failed",
|
||||
"code" => strval($response['errors']['code'] ?? 101),
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
$user->wallet = ($user->wallet ?? 0) + $data['amount'];
|
||||
$user->save();
|
||||
|
||||
$user->transactions()->where('authority', $data['authority'])->update(['status' => Transaction::STATUSES['success']]);
|
||||
|
||||
return response()->json([
|
||||
"wallet" => $user->wallet,
|
||||
"message" => "wallet charged succesfully",
|
||||
'ref_id' => $response['data']['ref_id'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getWalletAdmin(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'mobile' => 'required'
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $data['mobile'])->first()) {
|
||||
return response()->json(["message" => 'user not found'], 404);
|
||||
}
|
||||
|
||||
return response()->json(["wallet" => $user->wallet ?? 0]);
|
||||
}
|
||||
|
||||
public function chargeWalletAdmin(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'amount' => 'required|integer',
|
||||
'mobile' => 'required'
|
||||
]);
|
||||
|
||||
if (!$user = User::where('mobile', $data['mobile'])->first()) {
|
||||
return response()->json(["message" => 'user not found'], 404);
|
||||
}
|
||||
|
||||
$user->wallet = ($user->wallet ?? 0) + $data['amount'];
|
||||
$user->save();
|
||||
|
||||
return response()->json(["wallet" => $user->wallet, "message" => "wallet charged succesfully"]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\RedirectLinkHelper;
|
||||
use App\Models\Transaction;
|
||||
use App\Modules\Gateway\Zarinpal\ZarinpalApi;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ZarinpalController extends Controller
|
||||
{
|
||||
public function checkTransaction(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'Authority' => 'string|required',
|
||||
'Status' => 'string|required',
|
||||
]);
|
||||
|
||||
if (!$transaction = Transaction::with(['product.packageName', 'user'])->where('authority', $data['Authority'])->first()) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => '#'
|
||||
]);
|
||||
}
|
||||
|
||||
if ($data['Status'] != 'OK') {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$response = ZarinpalApi::checkTransaction($transaction);
|
||||
|
||||
if (!$response['status']) {
|
||||
return view('status', [
|
||||
'status' => false,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
|
||||
$transaction->update(['status' => Transaction::STATUSES['success']]);
|
||||
|
||||
$transaction->product->buy($transaction->user, $transaction['authority'], Transaction::GATEWAYS['asanpardakht']);
|
||||
|
||||
return view('status', [
|
||||
'status' => true,
|
||||
'redirect_link' => RedirectLinkHelper::get($transaction->product->packageName->name)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Http\Middleware\AutoBan;
|
||||
use App\Http\Middleware\BanBot;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's middleware aliases.
|
||||
*
|
||||
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'abilities' => \Laravel\Sanctum\Http\Middleware\CheckAbilities::class,
|
||||
'ability' => \Laravel\Sanctum\Http\Middleware\CheckForAnyAbility::class,
|
||||
'ban-bot' => BanBot::class,
|
||||
'auto-ban' => AutoBan::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*/
|
||||
protected function redirectTo(Request $request): ?string
|
||||
{
|
||||
return $request->expectsJson() ? null : route('login');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AutoBan
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->ip() == '91.92.190.63') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$bannedIps = Cache::get('banned-ips', ['62.212.88.47', '5.182.44.142', '185.244.36.217', '185.142.158.194', '188.229.86.48', '108.181.126.147',
|
||||
'94.182.91.226', '188.212.22.252', '185.55.225.6', '176.9.35.126', '93.115.223.250', '88.198.230.56',
|
||||
'185.94.98.252', '168.119.213.43', '193.151.150.73', '46.4.97.122', '192.42.116.176', '31.40.216.202']);
|
||||
|
||||
|
||||
if (in_array($request->ip(), [...$bannedIps])) {
|
||||
abort(403, ".|.");
|
||||
}
|
||||
|
||||
$ipTries = Cache::get($request->ip() . '-tries', 0);
|
||||
Cache::set($request->ip() . '-tries', $ipTries + 1, 600);
|
||||
|
||||
if ($ipTries > 30) {
|
||||
Cache::set('banned-ips', [...$bannedIps, $request->ip()]);
|
||||
}
|
||||
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class BanBot
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->header('cf-worker')) {
|
||||
return response()->json(['message' => 'unauthorized'], 403);
|
||||
}
|
||||
|
||||
if (in_array($request->ip(), ['23.95.132.45'])) {
|
||||
return response()->json(['message' => 'unauthorized'], 403);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts(): array
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\PackageName;
|
||||
use App\Models\Reminder;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Kreait\Firebase\Factory;
|
||||
use Kreait\Firebase\Messaging\CloudMessage;
|
||||
|
||||
class SendPushJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public function __construct(
|
||||
public User $user,
|
||||
public $title,
|
||||
public PackageName $packageName,
|
||||
public string $description = '',
|
||||
public array $data = []
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$firebaseFile = $this->getFirebaseJsonPath();
|
||||
|
||||
$factory = (new Factory)
|
||||
->withServiceAccount($firebaseFile);
|
||||
|
||||
$push = $factory->createMessaging();
|
||||
$message = CloudMessage::fromArray([
|
||||
'token' => $this->user->packageNames()->where('package_names.id', $this->packageName->id)->first()->pivot->fcm_token,
|
||||
'notification' => [
|
||||
'title' => $this->title,
|
||||
'body' => $this->description,
|
||||
],
|
||||
'data' => $this->data
|
||||
]);
|
||||
|
||||
$push->send($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Firebase JSON file path from Media Library for the package.
|
||||
*/
|
||||
private function getFirebaseJsonPath(): ?string
|
||||
{
|
||||
$media = $this->packageName->getFirstMedia('firebase_json');
|
||||
|
||||
if (!$media) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $media->getPath();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class SendSMSJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(private $data)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$response = Http::connectTimeout(5)->timeout(5)->get(config('kave.url'), [
|
||||
'receptor' => $this->data['mobile'],
|
||||
'message' => $this->data['message'],
|
||||
'date' => $this->data['date'] ?? null
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Backup\Events\BackupZipWasCreated;
|
||||
|
||||
class MailSuccessfulBackup
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param BackupZipWasCreated $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(BackupZipWasCreated $event)
|
||||
{
|
||||
$this->mailBackupFile($event->pathToZip);
|
||||
}
|
||||
|
||||
public function mailBackupFile($path)
|
||||
{
|
||||
Storage::disk('google')->put('approo_v2-backup.zip', file_get_contents($path));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VerifyEmailCodeMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $code;
|
||||
|
||||
public function __construct($code)
|
||||
{
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
return $this->subject('Your Email Verification Code')
|
||||
->view('emails.verify-code')
|
||||
->with(['code' => $this->code]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\ModelFilters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class PackageNameFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
||||
* As [relationMethod => [input_key1, input_key2]].
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $relations = [];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\ModelFilters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class ProductFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
||||
* As [relationMethod => [input_key1, input_key2]].
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $relations = [];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\ModelFilters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class TransactionFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
||||
* As [relationMethod => [input_key1, input_key2]].
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $relations = [];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\ModelFilters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class UserFilter extends ModelFilter
|
||||
{
|
||||
/**
|
||||
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
||||
* As [relationMethod => [input_key1, input_key2]].
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $relations = [];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasUuid;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CafeConfig extends Model
|
||||
{
|
||||
use HasFactory, HasUuid;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function packageNames()
|
||||
{
|
||||
return $this->hasMany(PackageName::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OldPurchase extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OtpTokens extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasUuid;
|
||||
use DateTimeInterface;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
|
||||
class PackageName extends Model implements HasMedia
|
||||
{
|
||||
use HasUuid, Filterable, InteractsWithMedia;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
const SOURCES = [
|
||||
'unknown' => 0,
|
||||
'google_play' => 1,
|
||||
'cafe' => 2,
|
||||
'myket' => 3,
|
||||
'web' => 4,
|
||||
];
|
||||
|
||||
public function registerMediaCollections(): void
|
||||
{
|
||||
$this->addMediaCollection('firebase_json')->singleFile();
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'user_package_name')->withPivot(['id', 'tries', 'source', 'fcm_token'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function getImageAttribute()
|
||||
{
|
||||
return url($this->attributes['image']);
|
||||
}
|
||||
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
|
||||
public function cafeConfig()
|
||||
{
|
||||
return $this->belongsTo(CafeConfig::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasUuid;
|
||||
use Carbon\Carbon;
|
||||
use DateTimeInterface;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use HasUuid, Filterable;
|
||||
|
||||
protected $guarded = [];
|
||||
const TYPES = [
|
||||
'permanent' => 1,
|
||||
'yearly' => 2,
|
||||
'6months' => 3,
|
||||
'monthly' => 4,
|
||||
];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'user_product')->withPivot(['expire_at', 'purchase_token', 'gateway'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function packageName()
|
||||
{
|
||||
return $this->belongsTo(PackageName::class);
|
||||
}
|
||||
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function buy($user, $purchaseToken = null, $gateway = null)
|
||||
{
|
||||
$expireDate = now();
|
||||
if ($purchaseUser = $this->users()->where('users.id', $user->id)->wherePivot('expire_at', '>=', now())->first()) {
|
||||
$expireDate = Carbon::parse($purchaseUser->pivot->expire_at) ?? now();
|
||||
}
|
||||
|
||||
$expireAt = match ($this->type) {
|
||||
1 => null,
|
||||
2 => $expireDate->addDays(30 * 12)->format('Y-m-d H:i:s'),
|
||||
3 => $expireDate->addDays(30 * 6)->format('Y-m-d H:i:s'),
|
||||
4 => $expireDate->addDays(30 * 1)->format('Y-m-d H:i:s'),
|
||||
};
|
||||
|
||||
if ($this->users()->where('users.id', $user->id)->exists()) {
|
||||
$this->users()->updateExistingPivot($user->id, [
|
||||
'expire_at' => $expireAt,
|
||||
'purchase_token' => $purchaseToken,
|
||||
'gateway' => $gateway,
|
||||
]);
|
||||
} else {
|
||||
$this->users()->attach($user->id, [
|
||||
'expire_at' => $expireAt,
|
||||
'purchase_token' => $purchaseToken,
|
||||
'gateway' => $gateway,
|
||||
]);
|
||||
}
|
||||
|
||||
$user->transactions()->where('authority', $purchaseToken)->update(['status' => Transaction::STATUSES['consumed']]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Reminder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
protected $casts = [
|
||||
'data' => 'array',
|
||||
'last_repeat' => 'date',
|
||||
];
|
||||
|
||||
public function packageName()
|
||||
{
|
||||
return $this->belongsTo(PackageName::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasUuid;
|
||||
use DateTimeInterface;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Transaction extends Model
|
||||
{
|
||||
use HasUuid, Filterable;
|
||||
|
||||
protected $guarded = [];
|
||||
const STATUSES = [
|
||||
'pending' => 1,
|
||||
'success' => 2,
|
||||
'consumed' => 3,
|
||||
'failed' => 3,
|
||||
];
|
||||
const GATEWAYS = [
|
||||
'asanpardakht' => 1,
|
||||
'zarinpal' => 2,
|
||||
'digipay' => 3,
|
||||
'cafe' => 4,
|
||||
'myket' => 5,
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasUuid;
|
||||
use DateTimeInterface;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Illuminate\Support\Str;
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable, HasUuid, Filterable;
|
||||
|
||||
const GENDERS = [
|
||||
'male' => 1,
|
||||
'female' => 2,
|
||||
];
|
||||
protected $guarded = [];
|
||||
protected $hidden = [
|
||||
'password',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'full_name'
|
||||
];
|
||||
// protected static function booted()
|
||||
// {
|
||||
// static::creating(function ($user) {
|
||||
// if (empty($user->uuid)) {
|
||||
// $user->uuid = (string) Str::uuid();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
public function getFullNameAttribute()
|
||||
{
|
||||
return $this->first_name . ' ' . $this->last_name;
|
||||
}
|
||||
|
||||
public function getAvatarAttribute()
|
||||
{
|
||||
return isset($this->attributes['avatar']) ? url($this->attributes['avatar']) : null;
|
||||
}
|
||||
|
||||
public function setPasswordAttribute($password)
|
||||
{
|
||||
$this->attributes['password'] = Hash::make($password);
|
||||
}
|
||||
|
||||
public function otpTokens()
|
||||
{
|
||||
return $this->hasMany(OtpTokens::class);
|
||||
}
|
||||
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasMany(Transaction::class);
|
||||
}
|
||||
|
||||
public function reminders()
|
||||
{
|
||||
return $this->hasMany(Reminder::class);
|
||||
}
|
||||
|
||||
public function packageNames()
|
||||
{
|
||||
return $this->belongsToMany(PackageName::class, 'user_package_name')->withPivot(['id', 'tries', 'source', 'fcm_token'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'user_product')->withPivot(['expire_at', 'purchase_token', 'gateway'])->withTimestamps();
|
||||
}
|
||||
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Gateway\AsanPardakht;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class AsanPardakhtApi
|
||||
{
|
||||
public static function getGateway(Transaction $transaction)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$response = Http::connectTimeout(5)->timeout(5)/* ->retry(3, 100, throw: false) */
|
||||
->acceptJson()
|
||||
->contentType('application/json')
|
||||
->withHeaders([
|
||||
'usr' => config('asanpardakht.user'),
|
||||
'pwd' => config('asanpardakht.password'),
|
||||
])
|
||||
->post(config('asanpardakht.url.request'), [
|
||||
'merchantConfigurationId' => config('asanpardakht.merchant_config_id'),
|
||||
'serviceTypeId' => 1,
|
||||
'localInvoiceId' => $transaction->id,
|
||||
'amountInRials' => $transaction->amount * 10,
|
||||
'localDate' => now()->format('Ymd His'),
|
||||
'additionalData' => json_encode([
|
||||
'mobile' => $user->mobile
|
||||
]),
|
||||
'callbackURL' => "https://payment.vada.ir/api/asanpardakht/check-transaction?localInvoiceId=$transaction->id" . (request()->get('platform') ? '&platform=' . request()->get('platform') : ''),
|
||||
'paymentId' => "0",
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
return ["message" => "failed", 'status' => false];
|
||||
}
|
||||
|
||||
return [
|
||||
'data' => [
|
||||
'url' => 'https://payment.vada.ir/api/asanpardakht/pay?token=' . $response->json() . '&mobile=' . $user->mobile,
|
||||
'authority' => $response->json()
|
||||
],
|
||||
'status' => true
|
||||
];
|
||||
}
|
||||
|
||||
public static function checkTransaction(Transaction $transaction)
|
||||
{
|
||||
$transactionResponse = self::transactionResult($transaction);
|
||||
if (!$transactionResponse) {
|
||||
return [
|
||||
'status' => false,
|
||||
];
|
||||
}
|
||||
|
||||
self::verify($transactionResponse['payGateTranID']);
|
||||
self::settlement($transactionResponse['payGateTranID']);
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public static function transactionResult(Transaction $transaction)
|
||||
{
|
||||
$response = Http::connectTimeout(5)->timeout(5)->retry(3, 100, throw: false)
|
||||
->acceptJson()
|
||||
->contentType('application/json')
|
||||
->withHeaders([
|
||||
'usr' => config('asanpardakht.user'),
|
||||
'pwd' => config('asanpardakht.password'),
|
||||
])
|
||||
->get(config('asanpardakht.url.result'), [
|
||||
'LocalInvoiceId' => $transaction->id,
|
||||
'MerchantConfigurationId' => config('asanpardakht.merchant_config_id'),
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
|
||||
public static function verify($payGateTranId)
|
||||
{
|
||||
$response = Http::connectTimeout(5)->timeout(5)->retry(3, 100, throw: false)
|
||||
->acceptJson()
|
||||
->contentType('application/json')
|
||||
->withHeaders([
|
||||
'usr' => config('asanpardakht.user'),
|
||||
'pwd' => config('asanpardakht.password'),
|
||||
])
|
||||
->post(config('asanpardakht.url.verify'), [
|
||||
'merchantConfigurationId' => config('asanpardakht.merchant_config_id'),
|
||||
'payGateTranId' => (int) $payGateTranId,
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
|
||||
public static function settlement($payGateTranId)
|
||||
{
|
||||
$response = Http::connectTimeout(5)->timeout(5)->retry(3, 100, throw: false)
|
||||
->acceptJson()
|
||||
->contentType('application/json')
|
||||
->withHeaders([
|
||||
'usr' => config('asanpardakht.user'),
|
||||
'pwd' => config('asanpardakht.password'),
|
||||
])
|
||||
->post(config('asanpardakht.url.settlement'), [
|
||||
'merchantConfigurationId' => config('asanpardakht.merchant_config_id'),
|
||||
'payGateTranId' => (int) $payGateTranId,
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Gateway\Digipay;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class DigiPayApi
|
||||
{
|
||||
public static function getToken()
|
||||
{
|
||||
$token = Cache::remember('digipay_token', 3600, function () {
|
||||
return Http::connectTimeout(5)->timeout(5)->retry(3, 100, throw: false)
|
||||
->asForm()
|
||||
->withHeaders([
|
||||
'Authorization' => 'Basic ' . config('digipay.api_key')
|
||||
])
|
||||
->post(config('digipay.url.login'), [
|
||||
'username' => config('digipay.username'),
|
||||
'password' => config('digipay.password'),
|
||||
'grant_type' => 'password',
|
||||
])['access_token'];
|
||||
});
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public static function getGateway(Transaction $transaction)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$response = Http::connectTimeout(5)->timeout(5)->retry(3, 100, throw: false)
|
||||
->withToken(self::getToken())
|
||||
->post(config('digipay.url.request'), [
|
||||
'providerId' => $transaction->uuid,
|
||||
'amount' => $transaction->amount * 10,
|
||||
'userType' => 0,
|
||||
'redirectUrl' => 'https://payment.vada.ir/api/digipay/check-transaction',
|
||||
'cellNumber' => $user->mobile,
|
||||
]);
|
||||
|
||||
if (!isset($response['payUrl'])) {
|
||||
return ["message" => "failed", 'status' => false];
|
||||
}
|
||||
|
||||
return [
|
||||
'data' => [
|
||||
'url' => $response['payUrl'],
|
||||
'authority' => $response['ticket']
|
||||
],
|
||||
'status' => true
|
||||
];
|
||||
}
|
||||
|
||||
public static function checkTransaction($trackingCode)
|
||||
{
|
||||
$response = Http::retry(3, 100, throw: false)
|
||||
->withToken(self::getToken())
|
||||
->post(str_replace(':trackingCode', $trackingCode, config('digipay.url.verify')));
|
||||
|
||||
if ($response['result']['status'] != 0) {
|
||||
return [
|
||||
'status' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Gateway\Zarinpal;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ZarinpalApi
|
||||
{
|
||||
public static function getGateway(Transaction $transaction, $description)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$merchantId = config('zarinpal.merchant_id');
|
||||
$response = Http::connectTimeout(2)->timeout(2)->retry(3, 500, throw: false)->post(config('zarinpal.url.request'), [
|
||||
'merchant_id' => $merchantId,
|
||||
'amount' => $transaction->amount * 10,
|
||||
'description' => $description,
|
||||
'callback_url' => 'https://payment.vada.ir/api/zarinpal/check-transaction',
|
||||
'metadata' => [
|
||||
'mobile' => $user->mobile
|
||||
],
|
||||
]);
|
||||
|
||||
if ($response['data'] == []) {
|
||||
return ["message" => "failed", 'status' => false];
|
||||
}
|
||||
|
||||
return [
|
||||
'data' => [
|
||||
'url' => config('zarinpal.url.pay') . $response['data']['authority'],
|
||||
'authority' => $response['data']['authority']
|
||||
],
|
||||
'status' => true
|
||||
];
|
||||
}
|
||||
|
||||
public static function checkTransaction(Transaction $transaction)
|
||||
{
|
||||
$merchantId = config('zarinpal.merchant_id');
|
||||
$response = Http::retry(3, 500, throw: false)->post(config('zarinpal.url.verify'), [
|
||||
'merchant_id' => $merchantId,
|
||||
'amount' => $transaction->amount * 10,
|
||||
'authority' => $transaction->authority,
|
||||
]);
|
||||
|
||||
if ($response['data'] == [] || $response['data']['code'] == 101) {
|
||||
return [
|
||||
'status' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Listeners\MailSuccessfulBackup;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
\Spatie\Backup\Events\BackupZipWasCreated::class => [
|
||||
MailSuccessfulBackup::class
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*/
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class GoogleDriveServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
\Illuminate\Support\Facades\Storage::extend('google', function ($app, $config) {
|
||||
$client = new \Google\Client();
|
||||
$client->setClientId($config['clientId']);
|
||||
$client->setClientSecret($config['clientSecret']);
|
||||
$client->refreshToken($config['refreshToken']);
|
||||
$service = new \Google\Service\Drive($client);
|
||||
|
||||
$options = [];
|
||||
if (isset($config['teamDriveId'])) {
|
||||
$options['teamDriveId'] = $config['teamDriveId'];
|
||||
}
|
||||
|
||||
$adapter = new \Masbug\Flysystem\GoogleDriveAdapter($service, $config['folder'] ?? '/', $options);
|
||||
$driver = new \League\Flysystem\Filesystem($adapter);
|
||||
return new \Illuminate\Filesystem\FilesystemAdapter($driver, $adapter);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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 your application's "home" route.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Telescope\IncomingEntry;
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||
|
||||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// Telescope::night();
|
||||
|
||||
$this->hideSensitiveRequestDetails();
|
||||
|
||||
// Telescope::filter(function (IncomingEntry $entry) {
|
||||
// if ($this->app->environment('local')) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// return $entry->isReportableException() ||
|
||||
// $entry->isFailedRequest() ||
|
||||
// $entry->isFailedJob() ||
|
||||
// $entry->isScheduledTask() ||
|
||||
// $entry->hasMonitoredTag();
|
||||
// });
|
||||
|
||||
Telescope::tag(function (IncomingEntry $entry) {
|
||||
if ($entry->type === 'request') {
|
||||
return ['status:' . $entry->content['response_status']];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
Telescope::tag(function (IncomingEntry $entry) {
|
||||
if ($entry->type === 'request' && $entry->user?->mobile)
|
||||
return [$entry->user->mobile];
|
||||
if ($entry->type === 'request' && $entry->user?->email)
|
||||
return [$entry->user->email];
|
||||
});
|
||||
|
||||
Telescope::tag(function (IncomingEntry $entry) {
|
||||
if ($entry->type === 'request')
|
||||
return [$entry->content['ip_address']];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent sensitive request details from being logged by Telescope.
|
||||
*/
|
||||
protected function hideSensitiveRequestDetails(): void
|
||||
{
|
||||
if ($this->app->environment('local')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telescope::hideRequestParameters(['_token']);
|
||||
|
||||
Telescope::hideRequestHeaders([
|
||||
'cookie',
|
||||
'x-csrf-token',
|
||||
'x-xsrf-token',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Telescope gate.
|
||||
*
|
||||
* This gate determines who can access Telescope in non-local environments.
|
||||
*/
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewTelescope', function ($user) {
|
||||
return true;
|
||||
// return in_array($user->email, [
|
||||
// //
|
||||
// ]);
|
||||
});
|
||||
}
|
||||
|
||||
protected function authorization()
|
||||
{
|
||||
$this->gate();
|
||||
|
||||
Telescope::auth(function ($request) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class MobileNumber implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $phone)
|
||||
{
|
||||
return self::checkMobileNumber($phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'شماره موبایل معتبر نیست';
|
||||
}
|
||||
|
||||
private static function checkMobileNumber($phone)
|
||||
{
|
||||
$pattern = '/(?:^(009809[\d]{9}|00989[\d]{9}|\+9809[\d]{9}|\+989[\d]{9}|989[\d]{9}|9809[\d]{9}|09[\d]{9}|9[\d]{9}))$/';
|
||||
if (!preg_match($pattern, $phone)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class CafeService
|
||||
{
|
||||
public function __construct(private $cafeConfig)
|
||||
{
|
||||
}
|
||||
|
||||
private function getToken()
|
||||
{
|
||||
if ($this->cafeConfig->token_refreshed_at > now()->subMinute(50)) {
|
||||
return $this->cafeConfig->access_token;
|
||||
}
|
||||
$response = Http::asForm()->post('https://pardakht.cafebazaar.ir/devapi/v2/auth/token/', [
|
||||
'grant_type' => 'refresh_token',
|
||||
'client_id' => $this->cafeConfig->client_id,
|
||||
'client_secret' => $this->cafeConfig->client_secret,
|
||||
'refresh_token' => $this->cafeConfig->refresh_token,
|
||||
]);
|
||||
$response = json_decode($response, true);
|
||||
if (isset($response['access_token'])) {
|
||||
$this->cafeConfig->access_token = $response['access_token'];
|
||||
$this->cafeConfig->token_refreshed_at = now();
|
||||
$this->cafeConfig->save();
|
||||
}
|
||||
|
||||
return $response['access_token'] ?? null;
|
||||
}
|
||||
|
||||
private function sendRequest($url, $method, $params = [])
|
||||
{
|
||||
$response = Http::connectTimeout(2)->timeout(5)->retry(3, 500, throw: false)->send($method, $url, [
|
||||
'headers' => [
|
||||
'Authorization' => $this->getToken()
|
||||
],
|
||||
'form_params' => $params
|
||||
]);
|
||||
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
public function checkPurchase($product, $token)
|
||||
{
|
||||
$response = $this->sendRequest("https://pardakht.cafebazaar.ir/devapi/v2/api/validate/{$product->packageName->name}/inapp/{$product->uuid}/purchases/$token/", 'GET');
|
||||
// if ($response['consumptionState']) {
|
||||
// return [
|
||||
// 'status' => false,
|
||||
// 'message' => 'already consumed',
|
||||
// ];
|
||||
// }
|
||||
|
||||
if ($response['purchaseState']) {
|
||||
return [
|
||||
'status' => false,
|
||||
'message' => 'refunded',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true
|
||||
];
|
||||
}
|
||||
|
||||
public function consumePurchase($product, $token)
|
||||
{
|
||||
if ($product->type == Product::TYPES['permanent']) {
|
||||
$response = $this->sendRequest("https://pardakht.cafebazaar.ir/devapi/v2/api/consume/{$product->packageName->name}/purchases/", 'POST', ['token' => $token]);
|
||||
}
|
||||
}
|
||||
|
||||
public function checkSubscription($product, $token)
|
||||
{
|
||||
$response = $this->sendRequest("https://pardakht.cafebazaar.ir/devapi/v2/api/applications/{$product->packageName->name}/active-subscriptions/$token/", 'GET');
|
||||
return $response['subscriptions'] ?? false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class MyketService
|
||||
{
|
||||
private function sendRequest($url, $method, $params = [], $packageName)
|
||||
{
|
||||
$response = Http::send($method, $url, [
|
||||
'headers' => [
|
||||
'X-Access-Token' => $packageName->myket_access_token
|
||||
],
|
||||
'form_params' => $params
|
||||
]);
|
||||
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
public function checkPurchase($product, $token)
|
||||
{
|
||||
$response = $this->sendRequest("https://developer.myket.ir/api/applications/{$product->packageName->name}/purchases/products/{$product->uuid}/tokens/$token", 'GET', [], $product->packageName);
|
||||
|
||||
if ($response['purchaseState']) {
|
||||
return [
|
||||
'status' => false,
|
||||
'message' => 'refunded',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => true
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait HasUuid
|
||||
{
|
||||
public static function bootHasUuid(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (!$model->uuid) {
|
||||
$model->uuid = Str::uuid()->toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"kreait/laravel-firebase": "^6.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/socialite": "^5.6",
|
||||
"laravel/telescope": "^5.11",
|
||||
"laravel/tinker": "^2.8",
|
||||
"masbug/flysystem-google-drive-ext": "^2.2",
|
||||
"predis/predis": "^2.1",
|
||||
"resend/resend-laravel": "^0.21.0",
|
||||
"spatie/laravel-backup": "^9.0",
|
||||
"spatie/laravel-medialibrary": "^11.0",
|
||||
"tucker-eric/eloquentfilter": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"spatie/laravel-ignition": "^2.0"
|
||||
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
Generated
+11761
File diff suppressed because it is too large
Load Diff
+192
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'Asia/Tehran',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'default_password' => env('DEFAULT_PASSWORD', '4B6ylG98zIt!'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => 'file',
|
||||
// 'store' => 'redis',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\GoogleDriveServiceProvider::class,
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'Example' => App\Facades\Example::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'admin_mobile' => '09001234567',
|
||||
'admin_otp' => '96969',
|
||||
'token' => 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJwYW5lbCIsImV4cCI6MTcxNTUwMjczMywiaWF0IjoxNjgzOTY2NzMzLCJpc3MiOiJodHRwczovL3d3dy5hcHByb28uaW8iLCJqdGkiOiIwZjRlMmRiNDVlZWQwZmMyMjY2N2RjNDQyZTRkYjM2YzM0MTM5NTNlIiwic3BlIjoicGFuZWwifQ.XYMGSSz6JPxYhnga0RMg5cZqD5QLtaoh1hXDkXJ3r2fA39d3HLiZpuxvz-_PRjtMbkiplKljoo2opyiUZ_D6QdfFbGo-2cjBDf17G-mpf15QljcMymp6O2aCnkoTVZr0ED_9oFSu6WMx26IzfqteokNKmU9Tnjz0aHHCujYv_sHjifolnVfhaeue7aIOQoAyDCVg2HQ8BNdgZwwD3FJEEhB2wV69Z_HVZpfv3hKvNea_ced2OsO-Bk7Siu1C_ea8GK3QsxyRrcvVIAe7f4tb0t8he52HSr_QuCsfCNZuDiuwhXglkJS1YIzF5Tvhc2veTLTI8-uwrKqvHVc_bATfYQ',
|
||||
'user_token' => 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJwYW5lbCIsImV4cCI6MTk5OTMyNjc0OCwiZXh0IjoiMTUyMzM5YzdhNTI4NDI3OTRkZTc0OWY2Y2FhZTBjNTVmMmRmMzgyNCIsImlhdCI6MTY4Mzk2Njc0OCwiaXNzIjoiaHR0cHM6Ly93d3cuYXBwcm9vLmlvIiwianRpIjoiZDU3MDMyMjJmNDg4YmY2ZWVhNjYyYmZlMWRjODI3Y2Q3OTcxMzZmMCIsInNwZSI6InBhbmVsIn0.W9TQgCdvGmVjWlFAjmDnieMlQR5FwEOJcKBQCczVSiTid6tmlfcuODLyVKLB7kiCMrKAr62aX0Adtea5HL82QgM4uIC-MBFmT2wstQZXF_lB03pn15kvi2YeuWSitIAcZTuq5tixa9z_phHFD6I3hx5y9AS6qj5NoG7AB_Xv2I6GZcbeegkDPpfsfpSQioLsTPGW_pYcSV16q20JCwH3XkC-eTCNGsA7Zg1Fru8IszJLDWFsLqNHwVNe3YDGOT8oTsIjs23kQTysQ7-zb-dUtOJJMN1Mz2OvDCauekGw6QDTcCeUo-O0ruzFrajw-9cDqTlWzHz4RIaGMYVCkHIZoA'
|
||||
];
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'url' => [
|
||||
'request' => 'https://ipgrest.asanpardakht.ir/v1/Token',
|
||||
'result' => 'https://ipgrest.asanpardakht.ir/v1/TranResult',
|
||||
'verify' => 'https://ipgrest.asanpardakht.ir/v1/Verify',
|
||||
'settlement' => 'https://ipgrest.asanpardakht.ir/v1/Settlement',
|
||||
],
|
||||
'user' => 'tosah4060863',
|
||||
'password' => 'M2QuBJi',
|
||||
'merchant_config_id' => 24426
|
||||
];
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_reset_tokens',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => 'Approo V2',
|
||||
|
||||
'source' => [
|
||||
|
||||
'files' => [
|
||||
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*
|
||||
* Directories used by the backup process will automatically be excluded.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'follow_links' => false,
|
||||
|
||||
/*
|
||||
* Determines if it should avoid unreadable folders.
|
||||
*/
|
||||
'ignore_unreadable_directories' => false,
|
||||
|
||||
/*
|
||||
* This path is used to make directories in resulting zip-file relative
|
||||
* Set to `null` to include complete absolute path
|
||||
* Example: base_path()
|
||||
*/
|
||||
'relative_path' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*
|
||||
* The content of the database dump may be customized for each connection
|
||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'excludeTables' => [
|
||||
* 'table_to_exclude_from_backup',
|
||||
* 'another_table_to_exclude'
|
||||
* ]
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* If you are using only InnoDB tables on a MySQL server, you can
|
||||
* also supply the useSingleTransaction option to avoid table locking.
|
||||
*
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'useSingleTransaction' => true,
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||
*/
|
||||
'databases' => [
|
||||
'pgsql',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The database dump can be compressed to decrease disk space usage.
|
||||
*
|
||||
* Out of the box Laravel-backup supplies
|
||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||
*
|
||||
* You can also create custom compressor. More info on that here:
|
||||
* https://github.com/spatie/db-dumper#using-compression
|
||||
*
|
||||
* If you do not want any compressor at all, set it to null.
|
||||
*/
|
||||
'database_dump_compressor' => null,
|
||||
|
||||
/*
|
||||
* The file extension used for the database dump files.
|
||||
*
|
||||
* If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
|
||||
* The file extension should be specified without a leading .
|
||||
*/
|
||||
'database_dump_file_extension' => '',
|
||||
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The filename prefix used for the backup zip file.
|
||||
*/
|
||||
'filename_prefix' => 'approo_v2',
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The directory where the temporary files will be stored.
|
||||
*/
|
||||
'temporary_directory' => storage_path('app/backup-temp'),
|
||||
|
||||
/*
|
||||
* The password to be used for archive encryption.
|
||||
* Set to `null` to disable encryption.
|
||||
*/
|
||||
'password' => env('BACKUP_ARCHIVE_PASSWORD'),
|
||||
|
||||
/*
|
||||
* The encryption algorithm to be used for archive encryption.
|
||||
* You can set it to `null` or `false` to disable encryption.
|
||||
*
|
||||
* When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
|
||||
* available on your system.
|
||||
*/
|
||||
'encryption' => 'default',
|
||||
],
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install laravel/slack-notification-channel.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Notifications\Notifications` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => 'amir.m.t1234@gmail.com',
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'approoV2@vada.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'ApprooV2'),
|
||||
],
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
|
||||
],
|
||||
|
||||
'discord' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is an empty string, the name field on the webhook will be used.
|
||||
*/
|
||||
'username' => '',
|
||||
|
||||
/*
|
||||
* If this is an empty string, the avatar on the webhook will be used.
|
||||
*/
|
||||
'avatar_url' => '',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound event will be fired.
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
'disks' => ['local'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* delete the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'default_strategy' => [
|
||||
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
|
||||
/*
|
||||
* The number of days for which daily backups must be kept.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 16,
|
||||
|
||||
/*
|
||||
* The number of weeks for which one weekly backup must be kept.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 8,
|
||||
|
||||
/*
|
||||
* The number of months for which one monthly backup must be kept.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
|
||||
/*
|
||||
* The number of years for which one yearly backup must be kept.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
*/
|
||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
'lock_connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
'lock_connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||
| stores there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
||||
@@ -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,
|
||||
|
||||
];
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'url' => [
|
||||
'login' => 'https://api.mydigipay.com/digipay/api/oauth/token',
|
||||
'request' => 'https://api.mydigipay.com/digipay/api/businesses/ticket?type=0',
|
||||
'verify' => 'https://api.mydigipay.com/digipay/api/purchases/verify/:trackingCode',
|
||||
],
|
||||
'username' => 'vada',
|
||||
'password' => 'LyXtAit8PPZz249',
|
||||
'api_key' => 'dmFkYS1jbGllbnQtaWQ6dmFkYS1jbGllbnQtc2VjcmV0LTk5ZjA0ODMyLWRmNzEtNDQ1NS05YTI1LTFjMDJmMzVkMzJjMg==',
|
||||
];
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been set up for each driver as an example of the required values.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
'google' => [
|
||||
'driver' => 'google',
|
||||
'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'),
|
||||
'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'),
|
||||
'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'),
|
||||
'folder' => env('GOOGLE_DRIVE_FOLDER'),
|
||||
// 'teamDriveId' => env('GOOGLE_DRIVE_TEAM_DRIVE_ID'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Default Firebase project
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'default' => env('FIREBASE_PROJECT', 'app'),
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Firebase project configurations
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'projects' => [
|
||||
'app' => [
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Credentials / Service Account
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* In order to access a Firebase project and its related services using a
|
||||
* server SDK, requests must be authenticated. For server-to-server
|
||||
* communication this is done with a Service Account.
|
||||
*
|
||||
* If you don't already have generated a Service Account, you can do so by
|
||||
* following the instructions from the official documentation pages at
|
||||
*
|
||||
* https://firebase.google.com/docs/admin/setup#initialize_the_sdk
|
||||
*
|
||||
* Once you have downloaded the Service Account JSON file, you can use it
|
||||
* to configure the package.
|
||||
*
|
||||
* If you don't provide credentials, the Firebase Admin SDK will try to
|
||||
* auto-discover them
|
||||
*
|
||||
* - by checking the environment variable FIREBASE_CREDENTIALS
|
||||
* - by checking the environment variable GOOGLE_APPLICATION_CREDENTIALS
|
||||
* - by trying to find Google's well known file
|
||||
* - by checking if the application is running on GCE/GCP
|
||||
*
|
||||
* If no credentials file can be found, an exception will be thrown the
|
||||
* first time you try to access a component of the Firebase Admin SDK.
|
||||
*
|
||||
*/
|
||||
|
||||
'credentials' => env('FIREBASE_CREDENTIALS', env('GOOGLE_APPLICATION_CREDENTIALS')),
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Firebase Auth Component
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'auth' => [
|
||||
'tenant_id' => env('FIREBASE_AUTH_TENANT_ID'),
|
||||
],
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Firestore Component
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'firestore' => [
|
||||
|
||||
/*
|
||||
* If you want to access a Firestore database other than the default database,
|
||||
* enter its name here.
|
||||
*
|
||||
* By default, the Firestore client will connect to the `(default)` database.
|
||||
*
|
||||
* https://firebase.google.com/docs/firestore/manage-databases
|
||||
*/
|
||||
|
||||
// 'database' => env('FIREBASE_FIRESTORE_DATABASE'),
|
||||
],
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Firebase Realtime Database
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'database' => [
|
||||
|
||||
/*
|
||||
* In most of the cases the project ID defined in the credentials file
|
||||
* determines the URL of your project's Realtime Database. If the
|
||||
* connection to the Realtime Database fails, you can override
|
||||
* its URL with the value you see at
|
||||
*
|
||||
* https://console.firebase.google.com/u/1/project/_/database
|
||||
*
|
||||
* Please make sure that you use a full URL like, for example,
|
||||
* https://my-project-id.firebaseio.com
|
||||
*/
|
||||
|
||||
'url' => env('FIREBASE_DATABASE_URL'),
|
||||
|
||||
/*
|
||||
* As a best practice, a service should have access to only the resources it needs.
|
||||
* To get more fine-grained control over the resources a Firebase app instance can access,
|
||||
* use a unique identifier in your Security Rules to represent your service.
|
||||
*
|
||||
* https://firebase.google.com/docs/database/admin/start#authenticate-with-limited-privileges
|
||||
*/
|
||||
|
||||
// 'auth_variable_override' => [
|
||||
// 'uid' => 'my-service-worker'
|
||||
// ],
|
||||
|
||||
],
|
||||
|
||||
'dynamic_links' => [
|
||||
|
||||
/*
|
||||
* Dynamic links can be built with any URL prefix registered on
|
||||
*
|
||||
* https://console.firebase.google.com/u/1/project/_/durablelinks/links/
|
||||
*
|
||||
* You can define one of those domains as the default for new Dynamic
|
||||
* Links created within your project.
|
||||
*
|
||||
* The value must be a valid domain, for example,
|
||||
* https://example.page.link
|
||||
*/
|
||||
|
||||
'default_domain' => env('FIREBASE_DYNAMIC_LINKS_DEFAULT_DOMAIN'),
|
||||
],
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Firebase Cloud Storage
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'storage' => [
|
||||
|
||||
/*
|
||||
* Your project's default storage bucket usually uses the project ID
|
||||
* as its name. If you have multiple storage buckets and want to
|
||||
* use another one as the default for your application, you can
|
||||
* override it here.
|
||||
*/
|
||||
|
||||
'default_bucket' => env('FIREBASE_STORAGE_DEFAULT_BUCKET'),
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Caching
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* The Firebase Admin SDK can cache some data returned from the Firebase
|
||||
* API, for example Google's public keys used to verify ID tokens.
|
||||
*
|
||||
*/
|
||||
|
||||
'cache_store' => env('FIREBASE_CACHE_STORE', 'file'),
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* Logging
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* Enable logging of HTTP interaction for insights and/or debugging.
|
||||
*
|
||||
* Log channels are defined in config/logging.php
|
||||
*
|
||||
* Successful HTTP messages are logged with the log level 'info'.
|
||||
* Failed HTTP messages are logged with the log level 'notice'.
|
||||
*
|
||||
* Note: Using the same channel for simple and debug logs will result in
|
||||
* two entries per request and response.
|
||||
*/
|
||||
|
||||
'logging' => [
|
||||
'http_log_channel' => env('FIREBASE_HTTP_LOG_CHANNEL'),
|
||||
'http_debug_log_channel' => env('FIREBASE_HTTP_DEBUG_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* HTTP Client Options
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* Behavior of the HTTP Client performing the API requests
|
||||
*/
|
||||
|
||||
'http_client_options' => [
|
||||
|
||||
/*
|
||||
* Use a proxy that all API requests should be passed through.
|
||||
* (default: none)
|
||||
*/
|
||||
|
||||
'proxy' => env('FIREBASE_HTTP_CLIENT_PROXY'),
|
||||
|
||||
/*
|
||||
* Set the maximum amount of seconds (float) that can pass before
|
||||
* a request is considered timed out
|
||||
*
|
||||
* The default time out can be reviewed at
|
||||
* https://github.com/kreait/firebase-php/blob/6.x/src/Firebase/Http/HttpClientOptions.php
|
||||
*/
|
||||
|
||||
'timeout' => env('FIREBASE_HTTP_CLIENT_TIMEOUT'),
|
||||
|
||||
'guzzle_middlewares' => [],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 65536,
|
||||
'threads' => 1,
|
||||
'time' => 4,
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'url' => 'https://api.kavenegar.com/v1/' . env('KAVE_API_KEY') . '/sms/send.json'
|
||||
];
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => 14,
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => LOG_USER,
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "log", "array", "failover"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* The disk on which to store added files and derived images by default. Choose
|
||||
* one or more of the disks you've configured in config/filesystems.php.
|
||||
*/
|
||||
'disk_name' => env('MEDIA_DISK', 'public'),
|
||||
|
||||
/*
|
||||
* The maximum file size of an item in bytes.
|
||||
* Adding a larger file will result in an exception.
|
||||
*/
|
||||
'max_file_size' => 1024 * 1024 * 10, // 10MB
|
||||
|
||||
/*
|
||||
* This queue connection will be used to generate derived and responsive images.
|
||||
* Leave empty to use the default queue connection.
|
||||
*/
|
||||
'queue_connection_name' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
* This queue will be used to generate derived and responsive images.
|
||||
* Leave empty to use the default queue.
|
||||
*/
|
||||
'queue_name' => '',
|
||||
|
||||
/*
|
||||
* By default all conversions will be performed on a queue.
|
||||
*/
|
||||
'queue_conversions_by_default' => env('QUEUE_CONVERSIONS_BY_DEFAULT', true),
|
||||
|
||||
/*
|
||||
* The fully qualified class name of the media model.
|
||||
*/
|
||||
'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,
|
||||
|
||||
/*
|
||||
* When enabled, media collections will be serialised using the default
|
||||
* laravel model serialization behaviour.
|
||||
*
|
||||
* Keep this option disabled if using Media Library Pro components (https://medialibrary.pro)
|
||||
*/
|
||||
'use_default_collection_serialization' => false,
|
||||
|
||||
/*
|
||||
* The fully qualified class name of the model used for temporary uploads.
|
||||
*
|
||||
* This model is only used in Media Library Pro (https://medialibrary.pro)
|
||||
*/
|
||||
'temporary_upload_model' => Spatie\MediaLibraryPro\Models\TemporaryUpload::class,
|
||||
|
||||
/*
|
||||
* When enabled, Media Library Pro will only process temporary uploads that were uploaded
|
||||
* in the same session. You can opt to disable this for stateless usage of
|
||||
* the pro components.
|
||||
*/
|
||||
'enable_temporary_uploads_session_affinity' => true,
|
||||
|
||||
/*
|
||||
* When enabled, Media Library pro will generate thumbnails for uploaded file.
|
||||
*/
|
||||
'generate_thumbnails_for_temporary_uploads' => true,
|
||||
|
||||
/*
|
||||
* This is the class that is responsible for naming generated files.
|
||||
*/
|
||||
'file_namer' => Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer::class,
|
||||
|
||||
/*
|
||||
* The class that contains the strategy for determining a media file's path.
|
||||
*/
|
||||
'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,
|
||||
|
||||
/*
|
||||
* The class that contains the strategy for determining how to remove files.
|
||||
*/
|
||||
'file_remover_class' => Spatie\MediaLibrary\Support\FileRemover\DefaultFileRemover::class,
|
||||
|
||||
/*
|
||||
* Here you can specify which path generator should be used for the given class.
|
||||
*/
|
||||
'custom_path_generators' => [
|
||||
// Model::class => PathGenerator::class
|
||||
// or
|
||||
// 'model_morph_alias' => PathGenerator::class
|
||||
],
|
||||
|
||||
/*
|
||||
* When urls to files get generated, this class will be called. Use the default
|
||||
* if your files are stored locally above the site root or on s3.
|
||||
*/
|
||||
'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
|
||||
|
||||
/*
|
||||
* Moves media on updating to keep path consistent. Enable it only with a custom
|
||||
* PathGenerator that uses, for example, the media UUID.
|
||||
*/
|
||||
'moves_media_on_update' => false,
|
||||
|
||||
/*
|
||||
* Whether to activate versioning when urls to files get generated.
|
||||
* When activated, this attaches a ?v=xx query string to the URL.
|
||||
*/
|
||||
'version_urls' => false,
|
||||
|
||||
/*
|
||||
* The media library will try to optimize all converted images by removing
|
||||
* metadata and applying a little bit of compression. These are
|
||||
* the optimizers that will be used by default.
|
||||
*/
|
||||
'image_optimizers' => [
|
||||
Spatie\ImageOptimizer\Optimizers\Jpegoptim::class => [
|
||||
'-m85', // set maximum quality to 85%
|
||||
'--force', // ensure that progressive generation is always done also if a little bigger
|
||||
'--strip-all', // this strips out all text information such as comments and EXIF data
|
||||
'--all-progressive', // this will make sure the resulting image is a progressive one
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Pngquant::class => [
|
||||
'--force', // required parameter for this package
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Optipng::class => [
|
||||
'-i0', // this will result in a non-interlaced, progressive scanned image
|
||||
'-o2', // this set the optimization level to two (multiple IDAT compression trials)
|
||||
'-quiet', // required parameter for this package
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Svgo::class => [
|
||||
'--disable=cleanupIDs', // disabling because it is known to cause troubles
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Gifsicle::class => [
|
||||
'-b', // required parameter for this package
|
||||
'-O3', // this produces the slowest but best results
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Cwebp::class => [
|
||||
'-m 6', // for the slowest compression method in order to get the best compression.
|
||||
'-pass 10', // for maximizing the amount of analysis pass.
|
||||
'-mt', // multithreading for some speed improvements.
|
||||
'-q 90', //quality factor that brings the least noticeable changes.
|
||||
],
|
||||
Spatie\ImageOptimizer\Optimizers\Avifenc::class => [
|
||||
'-a cq-level=23', // constant quality level, lower values mean better quality and greater file size (0-63).
|
||||
'-j all', // number of jobs (worker threads, "all" uses all available cores).
|
||||
'--min 0', // min quantizer for color (0-63).
|
||||
'--max 63', // max quantizer for color (0-63).
|
||||
'--minalpha 0', // min quantizer for alpha (0-63).
|
||||
'--maxalpha 63', // max quantizer for alpha (0-63).
|
||||
'-a end-usage=q', // rate control mode set to Constant Quality mode.
|
||||
'-a tune=ssim', // SSIM as tune the encoder for distortion metric.
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* These generators will be used to create an image of media files.
|
||||
*/
|
||||
'image_generators' => [
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Avif::class,
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
|
||||
Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* The path where to store temporary files while performing image conversions.
|
||||
* If set to null, storage_path('media-library/temp') will be used.
|
||||
*/
|
||||
'temporary_directory_path' => null,
|
||||
|
||||
/*
|
||||
* The engine that should perform the image conversions.
|
||||
* Should be either `gd` or `imagick`.
|
||||
*/
|
||||
'image_driver' => env('IMAGE_DRIVER', 'gd'),
|
||||
|
||||
/*
|
||||
* FFMPEG & FFProbe binaries paths, only used if you try to generate video
|
||||
* thumbnails and have installed the php-ffmpeg/php-ffmpeg composer
|
||||
* dependency.
|
||||
*/
|
||||
'ffmpeg_path' => env('FFMPEG_PATH', '/usr/bin/ffmpeg'),
|
||||
'ffprobe_path' => env('FFPROBE_PATH', '/usr/bin/ffprobe'),
|
||||
|
||||
/*
|
||||
* Here you can override the class names of the jobs used by this package. Make sure
|
||||
* your custom jobs extend the ones provided by the package.
|
||||
*/
|
||||
'jobs' => [
|
||||
'perform_conversions' => Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class,
|
||||
'generate_responsive_images' => Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* When using the addMediaFromUrl method you may want to replace the default downloader.
|
||||
* This is particularly useful when the url of the image is behind a firewall and
|
||||
* need to add additional flags, possibly using curl.
|
||||
*/
|
||||
'media_downloader' => Spatie\MediaLibrary\Downloaders\DefaultDownloader::class,
|
||||
|
||||
'remote' => [
|
||||
/*
|
||||
* Any extra headers that should be included when uploading media to
|
||||
* a remote disk. Even though supported headers may vary between
|
||||
* different drivers, a sensible default has been provided.
|
||||
*
|
||||
* Supported by S3: CacheControl, Expires, StorageClass,
|
||||
* ServerSideEncryption, Metadata, ACL, ContentEncoding
|
||||
*/
|
||||
'extra_headers' => [
|
||||
'CacheControl' => 'max-age=604800',
|
||||
],
|
||||
],
|
||||
|
||||
'responsive_images' => [
|
||||
/*
|
||||
* This class is responsible for calculating the target widths of the responsive
|
||||
* images. By default we optimize for filesize and create variations that each are 30%
|
||||
* smaller than the previous one. More info in the documentation.
|
||||
*
|
||||
* https://docs.spatie.be/laravel-medialibrary/v9/advanced-usage/generating-responsive-images
|
||||
*/
|
||||
'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class,
|
||||
|
||||
/*
|
||||
* By default rendering media to a responsive image will add some javascript and a tiny placeholder.
|
||||
* This ensures that the browser can already determine the correct layout.
|
||||
*/
|
||||
'use_tiny_placeholders' => true,
|
||||
|
||||
/*
|
||||
* This class will generate the tiny placeholder used for progressive image loading. By default
|
||||
* the media library will use a tiny blurred jpg image.
|
||||
*/
|
||||
'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* When enabling this option, a route will be registered that will enable
|
||||
* the Media Library Pro Vue and React components to move uploaded files
|
||||
* in a S3 bucket to their right place.
|
||||
*/
|
||||
'enable_vapor_uploads' => env('ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS', false),
|
||||
|
||||
/*
|
||||
* When converting Media instances to response the media library will add
|
||||
* a `loading` attribute to the `img` tag. Here you can set the default
|
||||
* value of that attribute.
|
||||
*
|
||||
* Possible values: 'lazy', 'eager', 'auto' or null if you don't want to set any loading instruction.
|
||||
*
|
||||
* More info: https://css-tricks.com/native-lazy-loading/
|
||||
*/
|
||||
'default_loading_attribute_value' => null,
|
||||
|
||||
/*
|
||||
* You can specify a prefix for that is used for storing all media.
|
||||
* If you set this to `/my-subdir`, all your media will be stored in a `/my-subdir` directory.
|
||||
*/
|
||||
'prefix' => env('MEDIA_PREFIX', ''),
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'access_tokens' => [
|
||||
'com.vada.newfarmoon' => '1e6f342d-1241-4ced-bc12-00b1f6f98ff7'
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,109 @@
|
||||
<?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,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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',
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'com*idea*newdev' => 'https://uzee.ir/golbeen',
|
||||
'com*vada*newmozahemyab' => 'https://uzee.ir/newmozahemyab',
|
||||
'com*vada*newmotarjemax' =>'https://uzee.ir/newmotarjemax',
|
||||
'com*appinaweek*cameradictgp' => 'https://uzee.ir/cameradictgp',
|
||||
'com*devgroup*motarjemax' => 'https://uzee.ir/motarjemax',
|
||||
'com*green*planto' => 'https://uzee.ir/planto',
|
||||
'com*idea*newtestdrive' => 'https://uzee.ir/newtestdrive',
|
||||
'com*blue*mozahemyab' => 'https://uzee.ir/mozahemyab',
|
||||
'com*devgroup*bishof' => 'https://uzee.ir/bishof',
|
||||
'com*green*mozahemyab' => 'https://uzee.ir/mozahemyab2',
|
||||
'com*green*testdrive' => 'https://uzee.ir/testdrive',
|
||||
'com*vada*karpardaz' => 'https://uzee.ir/karmand',
|
||||
'com*blue*karmandplus' => 'https://uzee.ir/karmandplus',
|
||||
'com*devgroup*smartcalorie' => 'https://uzee.ir/smartcalorie',
|
||||
'com*vada*falfltr' => 'https://uzee.ir/falfltr',
|
||||
'com*blue*fal' => 'https://uzee.ir/fal',
|
||||
'com*idea*dev' => 'https://uzee.ir/golbin',
|
||||
'com*idea*learnenglish' => 'https://uzee.ir/learnenglish',
|
||||
'com*devgroup*pets' => 'https://uzee.ir/com.devgroup.pets',
|
||||
'com*vada*dentalopg' => 'https://opgd.ir/web/',
|
||||
'com*devgroup*parents' => 'parentApplication://open',
|
||||
'com*mozahem*yab' => 'https://uzee.ir/com.mozahem.yab',
|
||||
'com*sobous*shomareyab' => 'https://uzee.ir/com.sobous.shomareyab',
|
||||
];
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. If this value is null, personal access tokens do
|
||||
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
'scheme' => 'https',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'google' => [
|
||||
'client_id' => env('GOOGLE_CLIENT_ID'),
|
||||
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
|
||||
'redirect' => env('GOOGLE_REDIRECT')
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Telescope\Http\Middleware\Authorize;
|
||||
use Laravel\Telescope\Watchers;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the subdomain where Telescope will be accessible from. If the
|
||||
| setting is null, Telescope will reside under the same domain as the
|
||||
| application. Otherwise, this value will be used as the subdomain.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('TELESCOPE_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the URI path where Telescope will be accessible from. Feel free
|
||||
| to change this path to anything you like. Note that the URI will not
|
||||
| affect the paths of its internal API that aren't exposed to users.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('TELESCOPE_PATH', 'telescope'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Storage Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This configuration options determines the storage driver that will
|
||||
| be used to store Telescope's data. In addition, you may set any
|
||||
| custom options as needed by the particular driver you choose.
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('TELESCOPE_DRIVER', 'database'),
|
||||
|
||||
'storage' => [
|
||||
'database' => [
|
||||
'connection' => env('DB_CONNECTION', 'mysql'),
|
||||
'chunk' => 1000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Master Switch
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option may be used to disable all Telescope watchers regardless
|
||||
| of their individual configuration, which simply provides a single
|
||||
| and convenient way to enable or disable Telescope data storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('TELESCOPE_ENABLED', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Route Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These middleware will be assigned to every Telescope route, giving you
|
||||
| the chance to add your own middleware to this list or change any of
|
||||
| the existing middleware. Or, you can simply stick with this list.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'web',
|
||||
Authorize::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed / Ignored Paths & Commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following array lists the URI paths and Artisan commands that will
|
||||
| not be watched by Telescope. In addition to this list, some Laravel
|
||||
| commands, like migrations and queue commands, are always ignored.
|
||||
|
|
||||
*/
|
||||
|
||||
'only_paths' => [
|
||||
// 'api/*'
|
||||
],
|
||||
|
||||
'ignore_paths' => [
|
||||
'nova-api*',
|
||||
],
|
||||
|
||||
'ignore_commands' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Watchers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following array lists the "watchers" that will be registered with
|
||||
| Telescope. The watchers gather the application's profile data when
|
||||
| a request or task is executed. Feel free to customize this list.
|
||||
|
|
||||
*/
|
||||
|
||||
'watchers' => [
|
||||
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
|
||||
|
||||
Watchers\CacheWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
|
||||
'hidden' => [],
|
||||
],
|
||||
|
||||
Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
|
||||
|
||||
Watchers\CommandWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
|
||||
'ignore' => [],
|
||||
],
|
||||
|
||||
Watchers\DumpWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
|
||||
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
|
||||
],
|
||||
|
||||
Watchers\EventWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
|
||||
'ignore' => [],
|
||||
],
|
||||
|
||||
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
|
||||
|
||||
Watchers\GateWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
|
||||
'ignore_abilities' => [],
|
||||
'ignore_packages' => true,
|
||||
'ignore_paths' => [],
|
||||
],
|
||||
|
||||
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
|
||||
|
||||
Watchers\LogWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_LOG_WATCHER', true),
|
||||
'level' => 'error',
|
||||
],
|
||||
|
||||
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
|
||||
|
||||
Watchers\ModelWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
|
||||
'events' => ['eloquent.*'],
|
||||
'hydrations' => true,
|
||||
],
|
||||
|
||||
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
|
||||
|
||||
Watchers\QueryWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
|
||||
'ignore_packages' => true,
|
||||
'ignore_paths' => [],
|
||||
'slow' => 100,
|
||||
],
|
||||
|
||||
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
|
||||
|
||||
Watchers\RequestWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
|
||||
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
|
||||
'ignore_http_methods' => [],
|
||||
'ignore_status_codes' => [],
|
||||
],
|
||||
|
||||
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
|
||||
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
|
||||
],
|
||||
];
|
||||
@@ -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'))
|
||||
),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'url' => [
|
||||
'request' => 'https://api.zarinpal.com/pg/v4/payment/request.json',
|
||||
'pay' => 'https://www.zarinpal.com/pg/StartPay/',
|
||||
'verify' => 'https://api.zarinpal.com/pg/v4/payment/verify.json',
|
||||
],
|
||||
// 'merchant_id' => '90c5ed4c-3190-4bd0-9af5-848b0a0f0294'
|
||||
'merchant_id' => 'bec1acb8-2022-11ea-be42-000c295eb8fc'
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user