ClearBowl/api/app/Repositories/ProductsRepository.php

26 lines
479 B
PHP
Raw Normal View History

2019-12-04 12:49:41 +01:00
<?php
namespace App\Repositories;
use App\Models\Product;
class ProductsRepository implements ProductsRepositoryInterface
{
public function create($data)
{
return Product::create($data);
}
2019-12-05 10:25:36 +01:00
2019-12-15 21:09:14 +01:00
public function paginate(array $filters)
2019-12-05 10:25:36 +01:00
{
2019-12-15 21:09:14 +01:00
$query = Product::query();
if(isset($filters['search'])){
$query->where('name', 'like', "${filters['search']}%");
}
return $query->paginate($filters['limit']);
2019-12-05 10:25:36 +01:00
}
2019-12-04 12:49:41 +01:00
}