Created
June 3, 2017 20:33
-
-
Save tabuna/0ab0145bb29b7614441e134be4359170 to your computer and use it in GitHub Desktop.
BlogController.php
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 | |
namespace App\Http\Controllers; | |
use Orchid\Core\Models\Post; | |
class BlogController extends Controller | |
{ | |
/** | |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | |
*/ | |
public function index() | |
{ | |
$posts = Post::type('blog') | |
->status('publish') | |
->with('attachment') | |
->orderBy('publish_at','Desc') | |
->simplePaginate(5); | |
return view('pages.main', [ | |
'posts' => $posts | |
]); | |
} | |
/** | |
* @param Post $post | |
* | |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | |
*/ | |
public function show(Post $post) | |
{ | |
return view('pages.post', [ | |
'post' => $post | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment