• Stars
    star
    149
  • Rank 248,619 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 9 months ago

Reviews

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

Repository Details

Basic Auditable package for Eloquent Model.

Laravel Auditable

Latest Version on Packagist Software License Build Status Total Downloads

Laravel Auditable is a simple Laravel auditing package for your Eloquent Model. This package automatically inserts/updates an audit log on your table on who created and last updated the record.

Install via Composer

composer require yajra/laravel-auditable

Publish config file

If you want to modify the withDefault option on auditable columns, you may publish the config file.

php artisan vendor:publish --tag=auditable

Usage

Update your model's migration and add created_by and updated_by field using the auditable() blueprint macro.

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name', 100);
    $table->auditable();
    $table->timestamps();
});

Then use AuditableTrait on your model.

namespace App;

use Yajra\Auditable\AuditableTrait;

class User extends Model
{
    use AuditableTrait;
}

Soft Deletes

If you wish to use Laravel's soft deletes, use the auditableWithDeletes() method on your migration instead:

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name', 100);
    $table->auditableWithDeletes();
    $table->timestamps();
    $table->softDeletes()
});

Afterwards, you need to use AuditableWithDeletesTrait on your model.

namespace App;

use Yajra\Auditable\AuditableWithDeletesTrait;

class User extends Model
{
    use AuditableWithDeletesTrait, SoftDeletes;
}

Dropping columns

You can drop auditable columns using dropAuditable() method, or dropAuditableWithDeletes() if using soft deletes.

Schema::create('users', function (Blueprint $table) {
    $table->dropAuditable();
});

And you're done! The package will now automatically add a basic audit log for your model to track who inserted and last updated your records.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

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

Credits

License

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

More Repositories

1

laravel-datatables

jQuery DataTables API for Laravel
PHP
4,740
star
2

laravel-oci8

Oracle DB driver for Laravel via OCI8
PHP
829
star
3

laravel-datatables-html

Laravel DataTables HTML Builder Plugin
PHP
272
star
4

laravel-datatables-buttons

Laravel DataTables Buttons Plugin
PHP
252
star
5

laravel-admin-template

Laravel 4.2 Bootstrap Admin Starter Template [with Oracle DB Support]
JavaScript
152
star
6

laravel-datatables-demo

Laravel Datatables Package Demo App
HTML
146
star
7

laravel-datatables-editor

Laravel DataTables Editor Integration.
PHP
115
star
8

laravel-acl

Laravel ACL is a simple role, permission ACL for Laravel Framework.
PHP
107
star
9

datatables

A package that installs the complete Laravel DataTables core & plugins.
PHP
96
star
10

laravel-datatables-fractal

Laravel DataTables Fractal Plugin.
PHP
95
star
11

laravel-datatables-docs

Laravel DaTatables package documentation
92
star
12

pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
PHP
88
star
13

laravel-disqus

A simple Disqus platform integration with Laravel.
PHP
84
star
14

laravel-address

Philippines Regions, Provinces, Cities and Barangays Address Lookup API for Laravel.
PHP
33
star
15

homestead-oracle

Laravel local development environment with Oracle XE 11g
Shell
31
star
16

laravel-datatables-export

Laravel DataTables Export plugin that uses queue, spout and livewire for bulk data export.
PHP
29
star
17

dt54

Laravel 5.4 DataTables Demo Application
PHP
24
star
18

laravel-datatables-vite

Laravel DataTables with Vite
JavaScript
20
star
19

cms-core

YajraCMS Core Module
PHP
19
star
20

zillow

A simple Laravel Wrapper for the Zillow API services.
PHP
15
star
21

laravel-datatables-scout

Laravel DataTables plugin to support Laravel Scout.
PHP
12
star
22

laravel-datatables-assets

A personal collection of DataTables server-side and client-side scripts.
JavaScript
10
star
23

laravel-datatables-ui

Laravel DataTables UI Preset
PHP
10
star
24

laravel-sql-loader

Oracle SQL*Loader for Laravel
PHP
9
star
25

yajrabox.com

Source code of yajrabox.com website.
PHP
7
star
26

laravel-4.1-starter-kit

Laravel 4.1 Starter Kit with Oracle DB Support
PHP
7
star
27

cms-themes

YajraCMS Themes Module
PHP
7
star
28

laravel-breadcrumbs

A simple Laravel style way to create breadcrumbs
PHP
6
star
29

laravel-datatables-tailwind-experiment

Blade
6
star
30

laravel-auditable-docs

Laravel Auditable Package Docs
5
star
31

laravel-oci8-docs

Laravel OCI8 package documentation
5
star
32

laravel-datatables-starter

Laravel 5.5 and DataTables starter kit.
PHP
5
star
33

laravel-acl-docs

Laravel ACL Docs
4
star
34

laravel-datatables-inertia

Laravel InertiaJS with DataTables
4
star
35

clean-blog

A clean blog theme for YajraCMS.
HTML
3
star
36

analytics-module

YajraCMS Google Analytics Module
HTML
2
star
37

yajra.github.io

HTML
1
star
38

laravel-datatables-compatibility

Laravel DataTables v8 plugin for v7 backward compatibility.
PHP
1
star
39

dt-searchpanes-demo

Laravel DataTables Server-Side searchPane demo
PHP
1
star
40

datatables.net-tailwindcss

jQuery DataTables using TailwindCSS with Editor support.
1
star