All Projects → conceptbyte → Time Traveller

conceptbyte / Time Traveller

Licence: mit
Time travel for your Laravel Models.

Projects that are alternatives of or similar to Time Traveller

Laravel Love
Add Social Reactions to Laravel Eloquent Models. It lets people express how they feel about the content. Fully customizable Weighted Reaction System & Reaction Type System with Like, Dislike and any other custom emotion types. Do you react?
Stars: ✭ 822 (+2183.33%)
Mutual labels:  eloquent, laravel
Validating
Automatically validating Eloquent models for Laravel
Stars: ✭ 906 (+2416.67%)
Mutual labels:  eloquent, laravel
Laravel Sluggable
An opinionated package to create slugs for Eloquent models
Stars: ✭ 831 (+2208.33%)
Mutual labels:  eloquent, laravel
Laravel Friendships
This package gives Eloquent models the ability to manage their friendships.
Stars: ✭ 651 (+1708.33%)
Mutual labels:  eloquent, laravel
Improved Polymorphic Eloquent Builder
🔨 Improved Polymorphic Eloquent Builder
Stars: ✭ 12 (-66.67%)
Mutual labels:  eloquent, laravel
Laravel Repositories
[ABANDONED] Rinvex Repository is a simple, intuitive, and smart implementation of Active Repository with extremely flexible & granular caching system for Laravel, used to abstract the data layer, making applications more flexible to maintain.
Stars: ✭ 664 (+1744.44%)
Mutual labels:  eloquent, laravel
Eloquent Ldap
A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.
Stars: ✭ 19 (-47.22%)
Mutual labels:  eloquent, laravel
Befriended
Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.
Stars: ✭ 596 (+1555.56%)
Mutual labels:  eloquent, laravel
Lighthouse Utils
An add-on to Lighthouse to auto-generate CRUD actions from types https://github.com/nuwave/lighthouse
Stars: ✭ 26 (-27.78%)
Mutual labels:  eloquent, laravel
Eloquent Filter
This simple package helps you filter Eloquent data using query filters.
Stars: ✭ 24 (-33.33%)
Mutual labels:  eloquent, laravel
Laravel Imageup
Auto Image & file upload, resize and crop for Laravel eloquent model using Intervention image
Stars: ✭ 646 (+1694.44%)
Mutual labels:  eloquent, laravel
Gorose
GoRose(go orm), a mini database ORM for golang, which inspired by the famous php framwork laravle's eloquent. It will be friendly for php developer and python or ruby developer. Currently provides six major database drivers: mysql,sqlite3,postgres,oracle,mssql, Clickhouse.
Stars: ✭ 947 (+2530.56%)
Mutual labels:  eloquent, laravel
Laravel Mongodb
A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
Stars: ✭ 5,860 (+16177.78%)
Mutual labels:  eloquent, laravel
Laravel
Laravel Model Generator
Stars: ✭ 715 (+1886.11%)
Mutual labels:  eloquent, laravel
Laravel Translatable
A Laravel package for multilingual models
Stars: ✭ 624 (+1633.33%)
Mutual labels:  eloquent, laravel
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (-47.22%)
Mutual labels:  eloquent, laravel
Laracsv
A Laravel package to easily generate CSV files from Eloquent model
Stars: ✭ 583 (+1519.44%)
Mutual labels:  eloquent, laravel
Laravel Schemaless Attributes
Add schemaless attributes to Eloquent models
Stars: ✭ 595 (+1552.78%)
Mutual labels:  eloquent, laravel
Eloquent Sortable
Sortable behaviour for Eloquent models
Stars: ✭ 914 (+2438.89%)
Mutual labels:  eloquent, laravel
Eloquent Driver
A package that allows you to store Statamic entries in a database.
Stars: ✭ 28 (-22.22%)
Mutual labels:  eloquent, laravel

Laravel Time Traveller

Time travelling for Laravel 5 models.

  • Uses database table to store model states.
  • Can be accessed from ORM or URL Query String.
  • Bundled command to keep revisions table healthy.
  • Ability to override Revisions model for extension.

Installation

Run the following command on your project root. composer require conceptbyte/time-traveller

Add the service provider to the config/app.php file under the providers key. Make sure to add it after the default laravel service providers.

'providers' => [
    ...,
    'ConceptByte\TimeTraveller\TimeTravellerServiceProvider'
]

Publish Configuration

Run php artisan vendor:publish to publish the package configurations.

Modify Configuration

Use the config/timetraveller.php file to modify the package defaults.

  • Revisions Model 'model' => ConceptByte\TimeTraveller\Models\Revision::class
  • Query String Parameter 'at' => 'at'
  • Clear audits that are older than 'clear' => '365'

Usage

Enable time traveller on a model by using the trait.

class Post extents Model
{
    use TimeTravel;
    
    public function getBy()
    {
        return Auth::user()->name;
    }
}

All models that use the trait must implement abstract public function getBy() which returns any string. This function can be used to save any additional attributes such as the owner of the change.

###Get the state of a record at a specific data/time.

Post::at('58781813')->find(1);

###Get the state of a record using a query string.

URL: timetravel.app/posts/1?at=58781813

Post::find(1);

###Get a model with revisions

Post::with('revisions')->first();

###You can clear the audits table records that are older than a specified range. php artisan time-traveller:clear. This will read the config file and clear records that are older than the configured number of days.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].