2022-11-20 03:51:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\Module;
|
2022-11-21 04:50:26 +00:00
|
|
|
use App\Models\Transaction;
|
|
|
|
use Illuminate\Http\Request;
|
2023-01-10 13:42:27 +00:00
|
|
|
use Illuminate\View\View;
|
2022-11-20 03:51:19 +00:00
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
2023-01-10 13:42:27 +00:00
|
|
|
public function index(): View
|
2022-11-20 12:32:49 +00:00
|
|
|
{
|
2023-02-02 11:40:05 +00:00
|
|
|
$modules = (new Module)->whereHasBalance("0.01")->paginate(10);
|
2022-11-20 03:51:19 +00:00
|
|
|
|
|
|
|
return view('admin.index', compact('modules'));
|
|
|
|
}
|
2022-11-21 04:50:26 +00:00
|
|
|
|
2023-01-10 13:42:27 +00:00
|
|
|
public function transactions(Request $request): View
|
2022-11-21 04:50:26 +00:00
|
|
|
{
|
|
|
|
$transactions = new Transaction();
|
|
|
|
|
2022-11-21 04:55:44 +00:00
|
|
|
if ($request->filled('user_id')) {
|
2022-11-21 04:50:26 +00:00
|
|
|
$transactions = $transactions->where('user_id', intval($request->input('user_id')));
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:55:44 +00:00
|
|
|
if ($request->filled('module_id')) {
|
2023-01-17 13:24:10 +00:00
|
|
|
$transactions = $transactions->where('module_id', $request->input('module_id'));
|
2022-11-21 04:50:26 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 04:55:44 +00:00
|
|
|
if ($request->filled('host_id')) {
|
2022-11-21 04:50:26 +00:00
|
|
|
$transactions = $transactions->where('host_id', intval($request->input('host_id')));
|
|
|
|
}
|
|
|
|
|
2022-11-21 04:55:44 +00:00
|
|
|
if ($request->filled('payment')) {
|
2022-11-21 04:50:26 +00:00
|
|
|
$transactions = $transactions->where('payment', $request->input('payment'));
|
|
|
|
}
|
|
|
|
|
2023-01-17 13:24:10 +00:00
|
|
|
$transactions = $transactions->latest()->paginate(50)->withQueryString();
|
2022-11-21 04:50:26 +00:00
|
|
|
|
|
|
|
return view('admin.transactions', compact('transactions'));
|
|
|
|
}
|
2022-11-20 03:51:19 +00:00
|
|
|
}
|