23 lines
513 B
PHP
23 lines
513 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\frontend;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Post;
|
|
use Illuminate\Http\Request;
|
|
|
|
class PostController extends Controller
|
|
{
|
|
//
|
|
public function view($slug = '')
|
|
{
|
|
$post = Post::where('slug', $slug)->first();
|
|
if (! $post)
|
|
{
|
|
return redirect()->route('home')->withErrors('Yêu cầu không hợp lệ');
|
|
}
|
|
$title = $post->name;
|
|
return view('frontend.post',compact('post','title'));
|
|
}
|
|
}
|