This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is a quick way to add authentication logging to Laravel. | |
1. Modify app/Providers/EventServiceProvider.php and add lines 16 through 32 of the example file in this GIST. | |
2. Create a new file app/Listeners/LogActivity.php and copy the contents of the file below into that file. | |
3. Enjoy logging. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatBytes(bytes,decimals) { | |
if(bytes == 0) return '0 Bytes'; | |
var k = 1024, | |
dm = decimals || 2, | |
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | |
} | |
// Usage: |