| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace App\Http\Controllers;
- use App\Models\CheckIn;
- use App\Models\User;
- use App\Http\Requests\StoreCheckInRequest;
- use App\Http\Requests\UpdateCheckInRequest;
- class CheckInController extends Controller
- {
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- //
- }
- public function draw_user_when_check_in(StoreCheckInRequest $request)
- {
- return CheckIn::where('is_checked_in', 'true')->get()->random($request->number);
- }
- public function draw_user_with_place(StoreCheckInRequest $request)
- {
- return CheckIn::where('is_checked_in', 'true')
- ->whereTime('check_ins.updated_at', '<=', '2023-02-08 08:23:42')
- ->whereIn('region', $request->region)
- ->get()
- ->random($request->number);
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function create()
- {
- //
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \App\Http\Requests\StoreCheckInRequest $request
- * @return \Illuminate\Http\Response
- */
- public function store(StoreCheckInRequest $request)
- {
- //
- }
- /**
- * Display the specified resource.
- *
- * @param \App\Models\CheckIn $checkIn
- * @return \Illuminate\Http\Response
- */
- public function show(CheckIn $checkIn)
- {
- //
- }
- /**
- * Show the form for editing the specified resource.
- *
- * @param \App\Models\CheckIn $checkIn
- * @return \Illuminate\Http\Response
- */
- public function edit(CheckIn $checkIn)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \App\Http\Requests\UpdateCheckInRequest $request
- * @param \App\Models\CheckIn $checkIn
- * @return \Illuminate\Http\Response
- */
- public function update(UpdateCheckInRequest $request, CheckIn $checkIn)
- {
- CheckIn::where('user_id', $request->userId)->update(['is_check_in' => true]);
- return 'success';
- }
- public function check_out(UpdateCheckInRequest $request, CheckIn $checkIn)
- {
- CheckIn::where('user_id', $request->userId)->update(['is_check_in' => false]);
- return 'success';
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param \App\Models\CheckIn $checkIn
- * @return \Illuminate\Http\Response
- */
- public function destroy(CheckIn $checkIn)
- {
- //
- }
- }
|