Заголовок проверки запроса Laravel

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;

Route::get('/', function () {
    class UserController extends Controller
    {
        public function store(Request $request)
        {
            if ($request->hasHeader('X-Header-Name')) {
                //
            }
        }
    }
});
Undefined