Esempio n. 1
0
 public function index($username)
 {
     $user = User::where('username', $username)->first();
     if (!$user) {
         abort('404');
     }
     return view('profile.index')->with('user', $user);
 }
Esempio 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}%")->orWhere('username', 'LIKE', "%{$query}%")->get();
     return view('search.results')->with('users', $users);
 }