BannersController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Http\Controllers\Api\Base;
  3. use App\Http\Controllers\Controller;
  4. use App\Repositories\Enums\ResponseCodeEnum;
  5. use Illuminate\Http\Request;
  6. use Jiannei\Response\Laravel\Support\Facades\Response;
  7. use Prettus\Validator\Contracts\ValidatorInterface;
  8. use App\Contracts\Repositories\Base\BannerRepository;
  9. use App\Repositories\Validators\Base\BannerValidator;
  10. /**
  11. * Class BannersController.
  12. *
  13. * @package namespace App\Http\Controllers\Base;
  14. */
  15. class BannersController extends Controller
  16. {
  17. /**
  18. * @var BannerRepository
  19. */
  20. protected $repository;
  21. /**
  22. * @var BannerValidator
  23. */
  24. protected $validator;
  25. /**
  26. * BannersController constructor.
  27. *
  28. * @param BannerRepository $repository
  29. * @param BannerValidator $validator
  30. */
  31. public function __construct(BannerRepository $repository, BannerValidator $validator)
  32. {
  33. $this->repository = $repository;
  34. $this->validator = $validator;
  35. }
  36. public function index(Request $request)
  37. {
  38. $lists = $this->repository->all();
  39. return Response::success($lists);
  40. }
  41. }