Created
December 23, 2020 13:57
-
-
Save bernard-ng/0b6c945ba38bd54acbe694c93f5c1937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpFoundation\Request; | |
// ... | |
public function delete(Request $request) | |
{ | |
$submittedToken = $request->request->get('token'); | |
// "delete-item" est la même valeur que celle utilisée dans le modèle pour générer le jeton | |
if ($this->isCsrfTokenValid('delete-item', $submittedToken)) { | |
// ... faire quelque chose, comme supprimer un objet | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment