LaravelPackages.net
Acme Inc.
Toggle sidebar
kchinkesh/laravel-model-observer

A Simple Laravel Package to observe,log and anlaize any changes to Eloquent Model using trait.

32
2
v1.0.1
About kchinkesh/laravel-model-observer

kchinkesh/laravel-model-observer is a Laravel package for a simple laravel package to observe,log and anlaize any changes to eloquent model using trait.. It currently has 2 GitHub stars and 32 downloads on Packagist (latest version v1.0.1). Install it with composer require kchinkesh/laravel-model-observer. Discover more Laravel packages by kchinkesh or browse all Laravel packages to compare alternatives.

Last updated

Laravel Model Observer

A Laravel Package to Log and analize all actions performed on a Eloquent Model.

Laravel Model Logger

Requirements

  • Laravel 7+
  • laravel/ui or laravel/breeze or jetstream for authentication purpose

Installation Instructions

  1. From Your Project's root Terminal run:
    composer require kchinkesh/laravel-model-observer
  2. Register the Package
    • Laravel 5.5 and up Uses package auto discovery feature, no need to edit the config/app.php file.
  3. Run the migration to add the table to record the activities to:
    php artisan migrate
    Note: If you want to specify a different table or connection make sure you update your .env file with the needed configuration variables.
  4. Optionally publish the packages views, config file, assets, and language files by running the following from your projects root folder:
    php artisan vendor:publish --tag=LaravelModelObserver

Usage

Trait Usage

Events can be recorded directly by using the trait inside your Model. To use the Trait:

  1. Include the call in the head of your model class file:
    use kchinkesh\LaravelModelObserver\App\Traits\ModelsObserver;
  2. Include the trait call in the opening of your model class:
    use ModelsObserver;

Routes

Model Activity Dashboard Routes

  • /actions
  • /actions/view/{id}

Screenshots

New Post

New Post

Posts

Posts

Edit Post

Edit Post

Model Logs

Logs

New Post Created Log

New

Post attributes change log

Change

Comments