54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
namespace App\JsonApi\MorphLegends;
|
|
|
|
use CloudCreativity\LaravelJsonApi\Eloquent\AbstractAdapter;
|
|
use CloudCreativity\LaravelJsonApi\Pagination\StandardStrategy;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Support\Collection;
|
|
|
|
class Adapter extends AbstractAdapter
|
|
{
|
|
|
|
/**
|
|
* Mapping of JSON API attribute field names to model keys.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $attributes = [];
|
|
|
|
/**
|
|
* Mapping of JSON API filter names to model scopes.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $filterScopes = [];
|
|
|
|
/**
|
|
* Adapter constructor.
|
|
*
|
|
* @param StandardStrategy $paging
|
|
*/
|
|
public function __construct(StandardStrategy $paging)
|
|
{
|
|
parent::__construct(new \App\MorphLegend(), $paging);
|
|
}
|
|
|
|
/**
|
|
* @param Builder $query
|
|
* @param Collection $filters
|
|
* @return void
|
|
*/
|
|
protected function filter($query, Collection $filters)
|
|
{
|
|
$this->filterWithScopes($query, $filters);
|
|
}
|
|
|
|
/**
|
|
* @return \CloudCreativity\LaravelJsonApi\Eloquent\HasMany
|
|
*/
|
|
protected function words()
|
|
{
|
|
return $this->hasMany();
|
|
}
|
|
}
|