Ejemplo n.º 1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     $data['websites_name'] = $request->input('websites_name');
     if ($this->check_repeat($data['websites_name'])) {
         return response()->json(['status' => false, 'message' => '网站已经存在']);
         exit;
     }
     $id = Website::insertGetId($data);
     if ($id) {
         return response()->json(['status' => true, 'message' => '数据插入成功', 'data' => $data]);
     } else {
         return response()->json(['status' => false, 'message' => '数据插入失败']);
     }
 }