Package Data | |
---|---|
Maintainer Username: | danyal14 |
Maintainer Contact: | danyal@hotmail.dk (Danyal Butt) |
Package Create Date: | 2019-02-18 |
Package Last Update: | 2019-05-12 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:13:24 |
Package Statistics | |
---|---|
Total Downloads: | 338 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Very simple package to log user activities. Aim is to capture which object was created / updated / deleted by which user. Package it self has no relation implemented and stores whatever is passed.
Danyal - www.danyal.dk
You can install the package via composer:
composer require danyaldk/lumen-activity-log
edit: bootstrap/app.php & add fillowing code
$app->register(\DANYALDK\ActivityLog\Providers\ActivityLogServiceProvider::class);
This will copy the database migration file file to you api database/migrations folder.
php artisan danyaldk:copy:migration
This will copy the database migration file file to you api database/migrations folder.
php artisan migrate
Now when package is configured successfully, you are good to utilize the activity log. Take a look at example MyController.
use DANYALDK\ActivityLog\ActivityLog;
use Illuminate\Http\Request;
/**
* Class MyController
*
* @package App\Http\Controllers
*/
class MyController extends Controller
{
public function store(Request $request)
{
// Example:
$object = Model::create([....]);
// Log activity:
if ($object->id) {
ActivityLog::log($request, ['object' => $object, 'user_id' => $user_id, 'message' => 'Object is created successfully']);
}
}
}