daijiro of Techpit
3/12/2020 - 10:16 AM

TagController.php

<?php

namespace App\Http\Controllers;

//==========ここから追加==========
use App\Tag;
//==========ここまで追加==========
use Illuminate\Http\Request;

class TagController extends Controller
{
    //==========ここから追加==========
    public function show(string $name)
    {
        $tag = Tag::where('name', $name)->first();

        return view('tags.show', ['tag' => $tag]);
    }
    //==========ここまで追加==========
}