ActivityController.php 622 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Controllers\Gteam;
  3. use App\Http\Controllers\Miniprogram\Auth;
  4. use App\Http\Resources\Gteam\ActivityResource;
  5. use App\Models\Gteam\ActivityModel;
  6. use App\Models\Gteam\EnterModel;
  7. use Illuminate\Http\Request;
  8. use App\Http\Controllers\Controller;
  9. class ActivityController extends Controller
  10. {
  11. //
  12. public function show(Request $request, $id)
  13. {
  14. $uid = Auth::auth();
  15. $activity = ActivityModel::findOrFail($id);
  16. $activity->enter = EnterModel::where(['activity_id' => $activity->id, 'uid' => $uid])->first();
  17. return new ActivityResource($activity);
  18. }
  19. }