You can create a custom helper function directly in bootstrap/app.php but there are better ways.
If you just want simple functions like Laravel's helpers, create a helpers.php file in your app directory and require it in your bootstrap/app.php file, then you can create all the custom function you want in it, for example:
<?php
function coolText($text) {
return 'Cool ' . $text;
}
and call it in your view:
<div>{{ coolText($someVar) }}</div>
For something more advanced you can create a Helper class in your app directory, bind it in your AppServiceProvider.php and add any method of your choice in this class.
app/Helpers.php
<?php namespace Helpers;
class Helpers
{
public function coolText($text)
{
return 'Cool ' . $text;
}
}
You can inject this class in your view or create a Facade for this class to access it in your view:
<div>{{ Helpers::coolText($someVar) }}</div>