Home
Logs
Fork
Export all
Schema
Model
Controller
Seeding
Form
Laravel 4.2
Add to favorites
Comments (2)
logs
id
increments
user_id
integer
loggable_id
integer
loggable_type
string
(64)
action
string
(64)
request_url
text
description
text
details
text
ip
string
(64)
user_agent
string
timestamps
timestamps
softDeletes
softDeletes
×
Comments for Logs
memfis61 . 08 April 2014
Example log event:
Event::listen('log', function($parameters = []) { $user = Services\Helpers\User::getUser(); $route = Route::getCurrentRoute(); if ($user && $route) { $action = $route->getAction(); if (!isset($parameters['loggable_type'])) $parameters['loggable_type'] = 'page'; if (!isset($parameters['loggable_type']) && isset($action['before'])) { $bA = explode('.', $action['before']); // Module Name if (isset($bA[1])) { $parameters['loggable_type'] = $bA[1]; } } $log = new ActivityLog; $log->user_id = $user->id; $log->loggable_type = $parameters['loggable_type']; $log->loggable_id = isset($parameters['loggable_id']) ? $parameters['loggable_id'] : NULL; $log->description = isset($parameters['description']) ? $parameters['description'] : NULL; $log->details = isset($parameters['details']) ? $parameters['details'] : NULL; $log->action = isset($action['as']) ? $action['as'] : (isset($action['controller']) ? $action['controller'] : $route->getPath()); $log->request_url = Request::path(); $log->ip = Request::getClientIp(); $log->user_agent = Agent::browser(); $log->save(); } });
memfis61 . 08 April 2014
We need documented schema. Help us!
Laravel Schema Designer v0.7.1
follow me on twitter
@okyn01