|
@@ 218-224 (lines=7) @@
|
| 215 |
|
* @param string $reason |
| 216 |
|
* @return mixed |
| 217 |
|
*/ |
| 218 |
|
public function latestUserPayment($userId, $reason = 'subscription') |
| 219 |
|
{ |
| 220 |
|
return $this->model->where('user_id', $userId) |
| 221 |
|
->whereRaw('reason = ? and (status = ? or status = ? or status = ?)', [$reason, 'paid', 'pending', 'withdrawn']) |
| 222 |
|
->orderBy('created_at', 'desc') |
| 223 |
|
->first(); |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
|
| 227 |
|
/** |
|
@@ 233-239 (lines=7) @@
|
| 230 |
|
* @param string $reason |
| 231 |
|
* @return mixed |
| 232 |
|
*/ |
| 233 |
|
public function getUserPaymentsByReason($userId, $reason) |
| 234 |
|
{ |
| 235 |
|
return $this->model->where('user_id', $userId) |
| 236 |
|
->whereRaw('reason = ? and (status = ? or status = ? or status = ?)', [$reason, 'paid', 'pending', 'withdrawn']) |
| 237 |
|
->orderBy('created_at', 'desc') |
| 238 |
|
->get(); |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
|
| 242 |
|
/** |
|
@@ 245-251 (lines=7) @@
|
| 242 |
|
/** |
| 243 |
|
* @param string $source |
| 244 |
|
*/ |
| 245 |
|
public function getUserPaymentsBySource($userId, $source) |
| 246 |
|
{ |
| 247 |
|
return $this->model->where('user_id', $userId) |
| 248 |
|
->whereRaw('source = ? and (status = ? or status = ? or status = ?)', [$source, 'paid', 'pending', 'withdrawn']) |
| 249 |
|
->orderBy('created_at', 'desc') |
| 250 |
|
->get(); |
| 251 |
|
} |
| 252 |
|
|
| 253 |
|
/** |
| 254 |
|
* Get all payments with a specific reference |
|
@@ 280-286 (lines=7) @@
|
| 277 |
|
* @param $userId |
| 278 |
|
* @return \Illuminate\Database\Eloquent\Collection |
| 279 |
|
*/ |
| 280 |
|
public function getBalancePaymentsPaginated($userId) |
| 281 |
|
{ |
| 282 |
|
return $this->model->where('user_id', $userId) |
| 283 |
|
->whereRaw('(source = ? or reason = ?) and (status = ? or status = ? or status = ?)', ['balance', 'balance', 'paid', 'pending', 'withdrawn']) |
| 284 |
|
->orderBy('created_at', 'desc') |
| 285 |
|
->simplePaginate($this->perPage); |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
|
| 289 |
|
/** |
|
@@ 294-300 (lines=7) @@
|
| 291 |
|
* @param integer $userId |
| 292 |
|
* @return mixed |
| 293 |
|
*/ |
| 294 |
|
public function getStorageBoxPayments($userId) |
| 295 |
|
{ |
| 296 |
|
return $this->model->where('user_id', $userId) |
| 297 |
|
->whereRaw('reason = ? and (status = ? or status = ? or status = ?)', ['storage-box', 'paid', 'pending', 'withdrawn']) |
| 298 |
|
->orderBy('created_at', 'desc') |
| 299 |
|
->get(); |
| 300 |
|
} |
| 301 |
|
|
| 302 |
|
public function dateFilter($startDate, $endDate) |
| 303 |
|
{ |