csrf_token

The csrf_token function retrieves the value of the current CSRF token:
<?php $token = csrf_token();
<?php {

    public function __invoke()

    {

        return csrf_token();

    }

}
<?php         Statamic::provideToScript([

            'version' => Statamic::version(),

            'laravelVersion' => app()->version(),

            'csrfToken' => csrf_token(),

            'cpUrl' => cp_route('index'),

            'cpRoot' => str_start(config('statamic.cp.route'), '/'),

            'urlPath' => Str::after(request()->getRequestUri(), config('statamic.cp.route').'/'),
<?php             'environment' => app()->environment(),

            'xml_header' => '<?xml version="1.0" encoding="utf-8" ?>', // @TODO remove and document new best practice

            'csrf_token' => csrf_token(),

            'csrf_field' => csrf_field(),

            'config' => config()->all(),

            'response_code' => 200,
<?php         tap($this->cascade()->hydrate()->toArray(), function ($cascade) {

            $this->assertEquals(app()->environment(), $cascade['environment']);

            $this->assertEquals('<?xml version="1.0" encoding="utf-8" ?>', $cascade['xml_header']);

            $this->assertEquals(csrf_token(), $cascade['csrf_token']);

            $this->assertEquals(csrf_field(), $cascade['csrf_field']);

            $this->assertEquals(config()->all(), $cascade['config']);