Skip to content

Commit 2f28e1b

Browse files
author
Tortue Torche
committed
Add a csrf_meta_tags() helper.
1 parent 4d96517 commit 2f28e1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Efficiently/JqueryLaravel/helpers.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,19 @@ function render_view($route, $parameters = [], $section = null)
227227
return $view;
228228
}
229229
}
230+
231+
if (! function_exists('csrf_meta_tags')) {
232+
233+
/**
234+
* Returns meta tags “csrf-param” and “csrf-token”
235+
* with the name of the cross-site request forgery protection
236+
* parameter and token, respectively.
237+
*
238+
* @return string
239+
*/
240+
function csrf_meta_tags()
241+
{
242+
return '<meta content="_token" name="csrf-param">'.PHP_EOL.
243+
'<meta content="'.csrf_token().'" name="csrf-token">'.PHP_EOL;
244+
}
245+
}

0 commit comments

Comments
 (0)