Exemplo n.º 1
0
 public function getProfile($fullname)
 {
     $user = User::where(DB::raw("CONCAT(first_name, ' ', last_name)"), 'LIKE', "%{$fullname}%")->first();
     if (!$user) {
         abort(404);
     }
     $notes = Note::where('user_id', $user->id)->orderBy('created_at', 'desc')->paginate(4);
     return view('profile.index')->with('mainuser', $user)->with('notes', $notes);
 }
Exemplo n.º 2
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}%")->get();
     $courses = Course::where('c_code', 'LIKE', "%{$query}%")->orWhere('c_name', 'LIKE', "%{$query}%")->get();
     return view('search.results')->with('users', $users)->with('courses', $courses);
 }
 public function getRemove($username)
 {
     $user = User::where(DB::raw("CONCAT(first_name, ' ', last_name)"), 'LIKE', "%{$username}%")->first();
     if (!$user) {
         return redirect()->route('home')->with('info', 'That user could not be found.');
     }
     if (!Auth::user()->isFollowing($user)) {
         return redirect()->route('profile.index', ['fullname' => $user->getName()])->with('info', 'You are already not following this user.');
     }
     Auth::user()->unFollowUser($user);
     //define in user model
     return redirect()->route('profile.index', ['fullname' => $user->getName()]);
 }
Exemplo n.º 4
0
 public function postSignup(Request $request)
 {
     $this->validate($request, ['firstname' => 'required|alpha|max:20', 'lastname' => 'alpha|max:20', 'email' => 'required|unique:students|email|max:255', 'password' => 'required|min:8']);
     User::create(['first_name' => $request->input('firstname'), 'last_name' => $request->input('lastname'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password'))]);
     return redirect()->route('home')->with('info', 'Your account has been created and you can now Sign In.');
 }
Exemplo n.º 5
0
 public function emailofWriter()
 {
     return User::where('id', $this->user_id)->first()->getEmail();
 }