コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Post::getPostsByType('post');
     $auth = new Auth();
     //Adds user's name to obj
     foreach ($posts as $key => $result) {
         $posts[$key]->name = $auth::user()->name;
     }
     return view('posts.index', compact('posts'));
 }
コード例 #2
0
ファイル: BlogController.php プロジェクト: joeyisking/sunbros
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //Returns an array of objects
     $blogs = Post::getPostsByType('blog');
     $auth = new Auth();
     //Adds user's name to obj
     foreach ($blogs as $key => $result) {
         $blogs[$key]->name = $auth::user()->name;
     }
     return view('blogs.index', compact('blogs'));
 }