ProfilePageController.php 1010B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\History;
  5. use App\Models\ProfilePart;
  6. use App\Supports\Response;
  7. use Carbon\Carbon;
  8. use Illuminate\Http\Request;
  9. use Illuminate\Support\Facades\DB;
  10. use Illuminate\Support\Facades\Log;
  11. /**
  12. * @group Lottery Prize
  13. */
  14. class ProfilePageController extends Controller
  15. {
  16. public function __construct(
  17. )
  18. {
  19. }
  20. public function list($locate = 'tw')
  21. {
  22. $locate = $locate == "tw" ? "zh_TW" : $locate;
  23. $data = ProfilePart::where("visible", 1)->orderByDesc("order")->get();
  24. $result = [];
  25. foreach($data as $item){
  26. $result["list"][] = [
  27. "title" => $item->getTranslation("title", $locate),
  28. "content" => $item->getTranslation("content", $locate),
  29. "imgUrl" => $item->img_url_link,
  30. "alt" => $item->getTranslation("img_alt", $locate)
  31. ];
  32. }
  33. return Response::ok($result);
  34. }
  35. }