Skip to content

Instantly share code, notes, and snippets.

@tabuna
Created June 3, 2017 20:33
Show Gist options
  • Save tabuna/0ab0145bb29b7614441e134be4359170 to your computer and use it in GitHub Desktop.
Save tabuna/0ab0145bb29b7614441e134be4359170 to your computer and use it in GitHub Desktop.
BlogController.php
<?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