<?php
namespace AppHttpControllers;
use AppModelsPost;
use IlluminateHttpRequest;
class PageController extends Controller
{
//
public function index(){
$posts = Post::latest("id")->get();
return view("index",["posts"=>$posts]);//compact($posts)
}
public function detail($slug){
$post = Post::where("slug",$slug)->firstOrfail();
return view('post.detail',compact('post'));
return $slug;
}
}