/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { abort_unauthorized(); $validation = $this->_validate($request->all()); $data = $validation->data; $data['errors'] = $validation->errors; if ($validation->passed) { $data['page_created'] = $this->_save($data); } return $data; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { abort_unauthorized(); $user = User::findOrFail($id); if ($user && Auth::user()->id != $id) { $user->archives()->delete(); $user->delete(); return ['success' => true]; } return ['success' => false]; }