You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.2 KiB
PHTML

1 year ago
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Customer;
use App\Models\DepositHistory;
use App\Models\PaylaterHistory;
use App\Models\PaylaterTenorHistory;
use App\Models\Sale;
1 year ago
class CustomerHistoryController extends Controller
{
public function deposit(Customer $customer)
1 year ago
{
$query = DepositHistory::with(['editor'])
->where('customer_id', $customer->id)
->where('type', DepositHistory::TYPE_DEPOSIT)
->orderBy('created_at', 'desc');
return inertia('CustomerHistory/DepositHistory', [
'query' => $query->paginate(),
'customer' => $customer,
]);
1 year ago
}
public function sale(Customer $customer)
1 year ago
{
$query = Sale::where('customer_id', $customer->id)
->orderBy('created_at', 'desc');
return inertia('CustomerHistory/SaleHistory', [
'query' => $query->paginate(),
'customer' => $customer,
]);
1 year ago
}
public function paylater(Customer $customer)
1 year ago
{
$query = PaylaterHistory::with(['editor'])
->where('customer_id', $customer->id)
1 year ago
->where('type', PaylaterHistory::TYPE_REPAYMENT)
->orderBy('created_at', 'desc');
return inertia('CustomerHistory/PaylaterHistory', [
'query' => $query->paginate(),
'customer' => $customer,
]);
1 year ago
}
public function paylater_limit(Customer $customer)
1 year ago
{
$query = PaylaterHistory::with(['creator'])
->where('type', PaylaterHistory::TYPE_UPGRADE)
->where('customer_id', $customer->id)
->orderBy('created_at', 'desc');
return inertia('CustomerHistory/PaylaterLimitHistory', [
'query' => $query->paginate(),
'customer' => $customer,
]);
1 year ago
}
public function paylater_deadline(Customer $customer)
1 year ago
{
$query = PaylaterTenorHistory::with(['creator'])
->where('customer_id', $customer->id)
->orderBy('created_at', 'desc');
return inertia('CustomerHistory/PaylaterTenorHistory', [
'query' => $query->paginate(),
'customer' => $customer,
]);
1 year ago
}
}