Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * 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];
 }