kcal/app/JsonApi/Adapters/FoodAdapter.php

45 lines
839 B
PHP

<?php
namespace App\JsonApi\Adapters;
use CloudCreativity\LaravelJsonApi\Eloquent\AbstractAdapter;
use CloudCreativity\LaravelJsonApi\Pagination\StandardStrategy;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
class FoodAdapter extends AbstractAdapter
{
/**
* {@inheritdoc}
*/
protected $attributes = [];
/**
* {@inheritdoc}
*/
protected $filterScopes = [];
/**
* {@inheritdoc}
*/
protected $defaultSort = ['name'];
/**
* {@inheritdoc}
*/
public function __construct(StandardStrategy $paging)
{
parent::__construct(new \App\Models\Food(), $paging);
}
/**
* {@inheritdoc}
*/
protected function filter($query, Collection $filters)
{
$this->filterWithScopes($query, $filters);
}
}