/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::check()) {
         $articles = Article::Join('users', 'users.id', '=', 'articles.user_id')->get(array('articles.*', 'users.name'));
         return view('index', compact('articles'))->with('page_title', 'My Articles')->with('username', Auth::user()->name);
     } else {
         return redirect('/auth/login');
     }
 }
 public function search()
 {
     if (Auth::check()) {
         $text = Input::get('query');
         $articles = Article::where('title', 'LIKE', '%' . $text . '%')->get();
         return view('/index', compact('articles'))->with('page_title', 'Search:' . $text)->with('username', Auth::user()->name);
     } else {
         return redirect('/auth/login');
     }
 }