hexathos/laravel-hasuserdata

Autofills updated_by, created_by, updated_at and created_at

v0.1.0 2022-09-30 11:52 UTC

This package is auto-updated.

Last update: 2024-09-29 06:14:58 UTC


README

About

This package automaticly adds username to models that have the Hexathos\Traits\HasUserData trait while creating or updating a Model.

It requires string-able fields "created_by" and "updated_by" in your database.

How to install

Require the package:

$ composer require hexathos/laravel-hasuserdata

Create a migration that adds created_by and updated_by fields to your models table

Include the Namespace in your Model and add the trait

namespace App\Models;

use Hexathos\Traits\HasUserData;

/* .snipped. */

use HasUserData;

That's it.