Support the ongoing development of Laravel.io →
Security Database
Last updated 2 years ago.
0

Ideally you would use the builtin Log system provided by Laravel and extend it as needed. The underlying service is Monolog and it is extendable and documented on Monologs site. You can use a model similar to what you've setup or access MySQL directly. All you really need to do is create your own custom handler. See the links below to get started. However, if you really want to create a "global" function then you should register the service in your app, you can reference the Service Provider link from the documentation below.

Docs on logging and errors: https://laravel.com/docs/5.2/errors

Useful starter for setting up your own custom log handler in Monolog: https://github.com/waza-ari/monolog-mysql/blob/master/src/MySQLHandler/MySQLHandler.php

Custom Service Providers: https://laravel.com/docs/5.2/providers

0

Sign in to participate in this thread!

Eventy

Your banner here too?

N3 n3 Joined 11 Mar 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.