Closed jnbn closed 8 years ago
Could you be more helpful by telling us where we could implement the function in a stock laravel 5.1~ project.
Hi xitude,
You can create your helper file which includes get_rollbar_user function like
<?php
function get_rollbar_user() {
if (Auth::check()) {
$user = Auth::user();
return array(
'id' => $user->id, // required - value is a string
'username' => $user->fullName(), // required - value is a string
'email' => $user->email, // optional - value is a string
);
}
return null;
}
and load it from composer by adding it manually to the files array under autoload like
...
"autoload": {
"classmap": [
"database"
],
"files": ["app/Http/helpers.php"], // location of the file you created
"psr-4": {
"App\\": "app/"
}
},
...
Perfect. Thanks :+1:
You can now assign and use person_fn from config file and use any user-defined helper function to pass person data to rollbar object.