33 lines
913 B
PHP
33 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Payment;
|
|
|
|
use App\Models\Payment;
|
|
use App\Repositories\BaseRepository;
|
|
|
|
class PaymentReppository extends BaseRepository implements PaymentReppositoryInterface
|
|
{
|
|
public function getModel()
|
|
{
|
|
return Payment::class;
|
|
}
|
|
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
|
{
|
|
$model = $this->model->with($relationships)->select($select);
|
|
|
|
if (isset($data['status'])) {
|
|
$model = $model->where("status", $data['status']);
|
|
}
|
|
if (isset($data['type'])) {
|
|
$model = $model->where("type", $data['type']);
|
|
}
|
|
if (count($withCount) > 0) {
|
|
$model = $model->withCount($withCount);
|
|
}
|
|
if(isset($data['page'])) {
|
|
return $model->paginate(15);
|
|
}
|
|
return $model->get();
|
|
}
|
|
}
|