123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Http\Controllers\Deed;
- use App\Http\Controllers\Core\Auth;
- use App\Models\Deed\PaintModel;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- class PaintController extends Controller
- {
- //
- public function index(Request $request)
- {
- }
- /**
- * 创建绘画
- * @param Request $request
- * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
- */
- public function store(Request $request)
- {
- $this->validate($request, [
- 'name' => 'required|max:8',
- 'pic_url' => 'required|url',
- 'actions' => 'required',
- ]);
- $uid = Auth::auth();
- $paint = PaintModel::create($request->merge(['uid' => $uid])->all());
- return response([
- 'code' => 200,
- 'message' => 'OK',
- 'data' => $paint
- ]);
- }
- /**
- * 查看指定绘画
- * @param $id
- * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
- */
- public function show($id)
- {
- $paint = PaintModel::findOrFail($id);
- $paint->user;
- return response([
- 'code' => 200,
- 'message' => 'OK',
- 'data' => $paint
- ]);
- }
- }
|