Update source into github
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user