Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mkwsra/c395a598f1f92feb6f2185e81684be84 to your computer and use it in GitHub Desktop.
Save mkwsra/c395a598f1f92feb6f2185e81684be84 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use App\Traits\HasUuid;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class PostController extends Controller
{
// ...
public function show(Post $post, Request $request)
{
// Handle the redirection to the new slug.
if (HasUuid::adjustShowURLSlug($post, $request)) {
return redirect($post->show_link);
}
// ...
return view('frontend.posts.show', compact('post'));
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment