Created
February 19, 2016 21:09
-
-
Save jgrossi/c670451b935e98abb9e6 to your computer and use it in GitHub Desktop.
Fetch posts and page details from a Laravel controller using Corcel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // File: /app/Http/Controllers/AnyController.php | |
// ... | |
public function index() | |
{ | |
$posts = Post::published()->take(10)->get(); | |
$page = Page::where('post_name', 'about')->first(); | |
return view('posts.index', compact('posts', 'page')); | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment