• Stars
    star
    58
  • Rank 514,575 (Top 11 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔍 Laravel package that allows you to track and log nested changes applied on your models

logo


Latest Version on Packagist

A laravel package that allows you to track and log nested changes applied on your (models, and their relations) using a single Trait

Installation

You can install the package via composer:

composer require mouadziani/laravel-model-trackable

Simple Usage

  • Firstly you have to apply trackable trait on your model
use LaravelModelTrackable\Traits\Trackable;

class ModelName extends Model
{
    use Trackable;

    //
}
  • In case you want to track the changes applied on your model's relationships, you need to add an attribute in your model called $toBeLoggedRelations which must contain an array of relationships like the example below
use LaravelModelTrackable\Traits\Trackable;

class ModelName extends Model
{
    use Trackable;

    public $toBeLoggedRelations = ['relation1', 'relation2'];
}
  • Then, you can get an array that should contains all changes applied on your model after every update
$model = ModelName::update([
    ...
]);

// Get list of changed attributes
$model->getChangedAttributes();

Disclaimer

Currently this package can't track hasMany, ManyToMany or MorphMany relations

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

featured_repository

More Repositories

1

xstate

✨ A lightweight state machine library for PHP (inspired by xstate.js)
PHP
85
star
2

laravel-query-inspector

The missing laravel helper that allows you to inspect your eloquent queries with it's bind parameters
PHP
56
star
3

mouadziani.com

🤵 My personal website, built with Nuxt.js and TailwindCss
Vue
43
star
4

laravel-deployer

Fast way to deploy your laravel project with one single command
Shell
40
star
5

laravel-mercanet

💵 A Laravel package for integrating the BnpParibas Mercanet
PHP
31
star
6

Larabye

🎉 Larabye (Laravel + Rockabye) is a mini PHP starter / framework inspired from laravel features
PHP
31
star
7

ur-fullstack-coding-challenge

💪 My own implementation of the United Remote web coding challenge.
PHP
15
star
8

awesome-rockabye

🎵 Best covers of ROCKABYE ( CLEAN BANDIT FT. SEAN PAUL & ANNE-MARIE ), Nb: Only for Rockabye lovers
12
star
9

mouadziani

11
star
10

operator-mono-font

10
star
11

design-patterns-in-java

☕️ Implementation of the most popular design patterns using JAVA
Java
10
star
12

30-days-of-spring

🌱 30 days of Spring Framework Challenge
Java
9
star
13

millions-backend-challenge

My own implementation of the backend challenge
PHP
8
star
14

file-upload-jhispter

The repository contains an example for upload file using Jhipster (Spring and Angular)
Java
6
star
15

trolls-maker

[WIP] - Web application that allows you to make your own memes
Vue
6
star
16

access-tests-management

🚀 This project is for first tests management, for university that has tests before registration of students for the scholar year based on Java swing
Java
6
star
17

excel-diff-checker

Excel-diff-checker is a python script to compare lines to find the difference between two csv files.
Python
6
star
18

me

☕️ My resume
CSS
4
star
19

ngrx-practices

TypeScript
4
star
20

mouadziani.github.io

Personal website 🤵🏼
HTML
4
star
21

trance

🎵 Collection of my preferred trance tracks (for trance hipsters only)
4
star
22

Value-Object-Maker

[WIP] Generate a Value Object class with attributes from your existing eloquent models with one single command
4
star
23

votes-system

PHP
3
star
24

messneger-ui

Messenger UI clone using Vuejs & Tailwind Css
Vue
3
star
25

Flutter_EXAM

This repository contains my own implementation of the final exam of the mobile development 2 module (Master ISI)
Dart
3
star
26

laravel-model-progressible

[WIP] Easily make your model entries progressible
3
star
27

github-actions-laravel

Shared configs to deploy your laravel project via SSH using github actions
3
star
28

sales-analysis-hadoop

Sales analysis program using Hadoop
Java
3
star
29

travels-template

Landing page travel website buit on html, css, js, bootstrap4 from scratch :)
HTML
3
star
30

spring-boot-security-starter

Spring boot with spring security starter
Java
2
star
31

hierarchical-clustering

Hierarchical Clustering with Python and Scikit-Learn
Jupyter Notebook
2
star
32

Agents_Communication_JADE_MADKIT

Exchange messages between agents using Jade and Madkit platforms
Java
2
star
33

nova-acl

[WIP] Full roles and permissions system for laravel nova panel
2
star
34

ify

IdeaForYou App with angular and spring boot
Java
2
star
35

software-security-notes

My notes while studying Software Security
1
star
36

student_coloco_web

PHP
1
star
37

ACADEMIC-WEB-DEVELOPMENT-PROJECTS

My academic projects that I created while learning web development as Master ISI Student
PHP
1
star
38

zero-spark

[WIP] - Laravel spark clone based on TALL stack (built for artisanal web developers)
1
star
39

WH-FE-SLICING-TEST

My own implementation of the WalletHub Frontend slicing Tests challenge.
HTML
1
star
40

pizza-delivry

Web application for manage pizza deliveries based on JavaEE (JSF & JPA)
Java
1
star
41

SPRING-MVC-ACADEMIC-PROJECTS

Java
1
star
42

logistique

JavaScript
1
star
43

cosmy-web

Social Network and E-commerce platform for hairdressers staff
CSS
1
star
44

users-manager

Web application for manage users based on Jave EE, MVC Pattern & DataSource JNDI
Java
1
star
45

hb-hs

CSS
1
star
46

personnes-manager

Demo descktop application based on Java Swing & MVC Pattern
Java
1
star
47

mastering-laravel-step-by-step

This repository will contains lot of laravel modules as exercises (made for H.S = ANTAR)
1
star
48

Laravel_EXAM

This repository contains my own implementation of the final exam of the backend web development module (Master ISI)
PHP
1
star
49

watchcrunch

PHP
1
star
50

WH-FE-NG-TEST

My own implementation of the WalletHub Angular Tests challenge.
TypeScript
1
star