Files
2025-07-24 16:18:27 +07:00

31 lines
848 B
PHP

<?php
namespace App\Repositories\Mail;
use App\Models\Mail;
use App\Repositories\BaseRepository;
class MailRepository extends BaseRepository implements MailRepositoryInterface
{
public function getModel()
{
return Mail::class;
}
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
{
$model = $this->model->with($relationships)->select($select);
if (isset($data['customer_id']) && ! empty($data['customer_id'])) {
$model = $model->where("customer_id", $data['customer_id']);
}
if (count($withCount) > 0) {
$model = $model->withCount($withCount);
}
if (isset($data['page'])) {
return $model->paginate(15);
}
return $model->get();
}
}