PaintController.php 716 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Controllers\Admin\Invite;
  3. use App\Http\Resources\Admin\Invite\PaintCollection;
  4. use App\Models\Deed\PaintModel;
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Controller;
  7. class PaintController extends Controller
  8. {
  9. /**
  10. * 走心一画列表
  11. * @param Request $request
  12. * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
  13. */
  14. public function index(Request $request)
  15. {
  16. $paints = PaintModel::paginate(
  17. 20,
  18. ['id', 'uid', 'name', 'pic_url', 'created_at', 'updated_at']
  19. );
  20. foreach ($paints as $paint) {
  21. $paint->user;
  22. }
  23. return new PaintCollection($paints);
  24. }
  25. }