コード例 #1
0
    public function postSignup(Request $request)
    {
        $this->validate($request, ['email' => 'required|unique:users|email|max:255', 'username' => 'required|unique:users|alpha_dash|max:20', 'password' => 'required|min:6']);
        User::create(['email' => $request->input('email'), 'username' => $request->input('username'), 'password' => bcrypt($request->input('password'))]);
        return redirect()->route('home')->with('info', 'Your account has been created and you can now sign in.
				');
    }
コード例 #2
0
 public function getProfile($username)
 {
     $user = User::where('username', $username)->first();
     if (!$user) {
         abort(404);
     }
     return view('profile.index')->with('user', $user);
 }
コード例 #3
0
 public function postDelete($username)
 {
     $user = User::where('username', $username)->first();
     if (!Auth::user()->isFriendsWith($user)) {
         return redirect()->back();
     }
     Auth::user()->deleteFriend($user);
     return redirect()->back()->with('info', 'Friend Deleted');
 }
コード例 #4
0
 public function getProfile($username)
 {
     $user = User::where('username', $username)->first();
     if (!$user) {
         abort(404);
     }
     $statuses = $user->statuses()->notReply()->get();
     return view('profile.index')->with('user', $user)->with('statuses', $statuses)->with('authUserIsFriend', Auth::user()->isFriendsWith($user));
 }
コード例 #5
0
 public function getResults(Request $request)
 {
     $query = $request->input('query');
     if (!$query) {
         return redirect()->route('home');
     }
     $users = User::where(DB::raw("CONCAT(first_name,'', last_name)"), 'LIKE', "%{$query}%")->orWhere('username', 'LIKE', "%{$query}%")->get();
     return view('search.results')->with('users', $users);
 }
コード例 #6
0
 public function getAccept($username)
 {
     $user = User::where('username', $username)->first();
     if (!$user) {
         return redirect()->route('home')->with('info', 'That user could not be found');
     }
     if (!Auth::user()->hasFriendRequestReceived($user)) {
         return redirect()->route('home');
     }
     Auth::user()->acceptFriendRequest($user);
     return redirect()->route('profile.index', ['username' => $username])->with('info', 'Friend request accepted.');
 }
コード例 #7
0
 public function postSignup(Request $request)
 {
     $this->validate($request, ['email' => 'required|unique:users|email|max:255', 'username' => 'required|unique:users|alpha_dash|max:20', 'password' => 'required|min:6|confirmed', 'password_confirmation' => 'required'], ['confirmed' => 'The passwords have to match.']);
     User::create(['email' => $request->input('email'), 'username' => $request->input('username'), 'password' => bcrypt($request->input('password')), 'active' => false]);
     return redirect()->route('home')->with('info', 'Your account has been successfully created!');
 }