ImportModel.php
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Models\Concerns; |
| 4 | |
| 5 | use SureCart\Models\Import; |
| 6 | use SureCart\Models\Model; |
| 7 | |
| 8 | /** |
| 9 | * Import model trait |
| 10 | */ |
| 11 | abstract class ImportModel extends Model { |
| 12 | /** |
| 13 | * Rest API endpoint. |
| 14 | * |
| 15 | * @var string |
| 16 | */ |
| 17 | protected $endpoint = 'imports'; |
| 18 | |
| 19 | /** |
| 20 | * Object name. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | protected $object_name = 'import'; |
| 25 | |
| 26 | /** |
| 27 | * Find a product import by id. |
| 28 | * |
| 29 | * @param string $id The id of the product import. |
| 30 | * |
| 31 | * @return Import|false |
| 32 | */ |
| 33 | protected function find( $id = '' ) { |
| 34 | return ( new Import() )->find( $id ); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Get a product import by id. |
| 39 | * |
| 40 | * @param array $args Pagination args. |
| 41 | * @return mixed |
| 42 | */ |
| 43 | protected function paginate( $args = [] ) { |
| 44 | return ( new Import() )->paginate( $args ); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Fetch a list of items. |
| 49 | * |
| 50 | * @return array|\WP_Error; |
| 51 | */ |
| 52 | protected function get() { |
| 53 | return ( new Import() )->get(); |
| 54 | } |
| 55 | } |
| 56 |