1. Go to this page and download the library: Download devraeph/laravel-alh library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/*
* Uses default mechanism
* configured in config/alh.php
* default only toFile and not in production
*/
ALH::error("Error message",new Exception("ex"));
ALH::warning("Warning message",new Exception("ex"));
ALH::info("Info message");
ALH::success("Success message");
ALH::pending("Pending message");
/*
* Override config settings
*/
/* Log Only to DB */
ALH::toDB()->error("Error message",new Exception("ex"));
/* Log only to File */
ALH::toFile()->error("Error message",new Exception("ex"));
/* Force Log both */
ALH::toDB()->toFile()->error("Error message",new Exception("ex"));
/*
* Option to set Log issuer like User
*/
ALH::setIssuer(User::first())->error("Error message",new Exception("ex"));
protected function gate(): void
{
Gate::define('viewALH', function (User $user) {
return in_array($user->email, [
//
]);
});
}