I suppose you should do it in controller, not in template.
You can use regex for that smth like this:
preg_replace('/[a-zA-Z.]/', '', $string);
If you're really need it to use in blade template, you can create some additional file with helper function, and use it anywhere you whant:
function filterFileName($string) {
return preg_replace('/[a-zA-Z.]/', '', $string);
}
- Create helpers.php file
- Add your function filterFileName in it.
- Add that file in composer.json and load it
with composer dump-autoload
- Now, you can use it in template:
{{ filterFileName($string) }}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…