mirror of https://github.com/kcal-app/kcal.git
				
				
				
			
		
			
				
	
	
		
			54 lines
		
	
	
		
			1016 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1016 B
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| 
 | |
| namespace App\JsonApi\Adapters;
 | |
| 
 | |
| use App\Models\RecipeStep;
 | |
| use CloudCreativity\LaravelJsonApi\Eloquent\AbstractAdapter;
 | |
| use CloudCreativity\LaravelJsonApi\Eloquent\BelongsTo;
 | |
| use CloudCreativity\LaravelJsonApi\Pagination\StandardStrategy;
 | |
| use Illuminate\Support\Collection;
 | |
| 
 | |
| class RecipeStepAdapter extends AbstractAdapter
 | |
| {
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     protected $attributes = [];
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     protected $filterScopes = [];
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     protected $defaultSort = ['number'];
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     public function __construct(StandardStrategy $paging)
 | |
|     {
 | |
|         parent::__construct(new RecipeStep(), $paging);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     protected function filter($query, Collection $filters)
 | |
|     {
 | |
|         $this->filterWithScopes($query, $filters);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Recipe relationship.
 | |
|      */
 | |
|     protected function recipe(): BelongsTo
 | |
|     {
 | |
|         return $this->belongsTo();
 | |
|     }
 | |
| 
 | |
| }
 |