2017 © Pedro Peláez
 

library activity-logs

Laravel package API for user activity logs

image

mark-villudo/activity-logs

Laravel package API for user activity logs

  • Friday, July 6, 2018
  • by Mark Villudo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Activity logs

Laravel package to log each user's activity in the system., (*1)

Usage after Installed package.

storeActivity('user type' , 'User Action', 'Description');

Installation

Require this package with composer., (*2)

composer require mark-villudo/activity-logs

Setup Migrations and Model

Make model with migration file at the same time. br/ Note: At the package the model used is under "App\Models\" then please do so., (*3)

php artisan make:model Models/ActivityLog -m

Activity Logs Table Structure, (*4)

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivityLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity_logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->nullable();
            $table->string('type', 32)->nullable();
            $table->text('action'); //required
            $table->text('description')->nullable();
            $table->string('ip_address', 64)->nullable();
            $table->text('device')->nullable();
            $table->text('platform')->nullable();
            $table->text('browser')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('activity_logs');
    }
}

Migrate table using composer and it's automatically create table in the database, (*5)

php artisan migrate

Usage

  //Parameter details (userType , action, description)
  storeActivity('Admin', 'Update Profile', 'Update Profile Settings');

License

The MIT License (MIT). Please see License File for more information., (*6)

The Versions

06/07 2018

dev-master

9999999-dev

Laravel package API for user activity logs

  Sources   Download

The Requires

  • php >=7.0.0

 

by Avatar Mark Villudo

laravel api activity-logs