feature: form edit
This commit is contained in:
@@ -219,11 +219,18 @@ class AdminService implements AdminServiceInterface
|
||||
return User::where('msnv', $msnv)->firstOrFail();
|
||||
}
|
||||
|
||||
public function getAddCardsHistory(string $buyerMsnv): \Illuminate\Database\Eloquent\Collection
|
||||
public function getAddCardsHistory(string $buyerMsnv, ?string $selectedMonth = null): \Illuminate\Database\Eloquent\Collection
|
||||
{
|
||||
return AddCard::with('sellerUser')
|
||||
->where('buyer', $buyerMsnv)
|
||||
->orderBy('date', 'desc')
|
||||
$query = AddCard::with('sellerUser')
|
||||
->where('buyer', $buyerMsnv);
|
||||
|
||||
if ($selectedMonth) {
|
||||
$startOfMonth = Carbon::parse($selectedMonth)->startOfMonth()->format('Y-m-d');
|
||||
$endOfMonth = Carbon::parse($selectedMonth)->endOfMonth()->format('Y-m-d');
|
||||
$query->whereBetween('date', [$startOfMonth, $endOfMonth]);
|
||||
}
|
||||
|
||||
return $query->orderBy('date', 'desc')
|
||||
->orderBy('id', 'desc')
|
||||
->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user