123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Http\Controllers\Api\V1\Mentality;
- use Illuminate\Http\Request;
- use App\Facades\DiarySleepFacade;
- use App\Http\Controllers\Api\V1\BaseController;
- use Carbon\Carbon;
- class SleepController extends BaseController
- {
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- $conditions = [
- 'uid' => $this->auth()
- ];
- $fields = ['*'];
- $sort = '`id` desc';
- $page = request('page', 1);
- $limit = request('limit', 20);
-
- return DiarySleepFacade::getList($conditions, $fields, $sort, $page, $limit);
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- $data = $request->all();
- $data['uid'] = $this->auth();
- $data['day'] = Carbon::today()->toDateString();
- $data['repeat'] = 'day:'.$data['day'].' uid:'.$data['uid'];
- return DiarySleepFacade::create($data);
- }
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function show($id)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, $id)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return \Illuminate\Http\Response
- */
- public function destroy($id)
- {
- //
- }
- }
|