Ejemplo n.º 1
0
 public function deleteComment(Request $request)
 {
     $c = Comment::findOrFail($request->get('comment_id'));
     $u = User::findOrFail(Auth::id());
     if ($u->id != $c->user_id && $u->flag != 1) {
         return 'You ain\'t got access bro';
     } else {
         $c->activated = false;
         $c->save();
         return \Redirect::back()->with('message', 'Deleted (go to admin panel to un-delete it)');
     }
 }
Ejemplo n.º 2
0
 public function changeUserData($id, Request $request)
 {
     if (Gate::denies('admin')) {
         return 'You ain\'t got access bro';
     } else {
         $u = User::findOrFail($id);
         $flag = $request->get('flag');
         $name = $request->get('username');
         $email = $request->get('email');
         if ($flag != null) {
             $u->flag = $flag;
         }
         if ($email != null) {
             $u->email = $email;
         }
         if ($name != null) {
             $u->name = $name;
         }
         $u->save();
         return \Redirect::to('/admin/users/' . $id)->with('message', 'User data has been changed!');
     }
 }
Ejemplo n.º 3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }