PlatformContentRepository.php 669 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\PlatformContent;
  4. use Symfony\Component\HttpKernel\Exception\HttpException;
  5. /**
  6. * Created by PhpStorm.
  7. * User: durong
  8. * Date: 2019/6/17
  9. * Time: 下午6:46
  10. */
  11. class PlatformContentRepository
  12. {
  13. public function __construct(PlatformContent $platformContent)
  14. {
  15. $this->platformContent = $platformContent;
  16. }
  17. public function index($request)
  18. {
  19. $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE');
  20. $this->platformContent = $this->platformContent
  21. ->orderBy('id', 'desc');
  22. return $this->platformContent->paginate($perPage);
  23. }
  24. }