ClearBowl/api/app/Repositories/ProductsRepository.php

26 lines
479 B
PHP

<?php
namespace App\Repositories;
use App\Models\Product;
class ProductsRepository implements ProductsRepositoryInterface
{
public function create($data)
{
return Product::create($data);
}
public function paginate(array $filters)
{
$query = Product::query();
if(isset($filters['search'])){
$query->where('name', 'like', "${filters['search']}%");
}
return $query->paginate($filters['limit']);
}
}