Download the PHP package sukohi/back-then without Composer

On this page you can find all versions of the php package sukohi/back-then. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package back-then

BackThen

A Laravel package for managing reivision of database. (This package is for Laravel 5+)

Installation

Execute the following composer command.

composer require sukohi/back-then:1.*

then set BackThenServiceProvider in your config/app.php.

Sukohi\BackThen\BackThenServiceProvider::class, 

Preparation

To make a table for this package, execute the following commands.

php artisan vendor:publish --provider="Sukohi\BackThen\BackThenServiceProvider"

and

php artisan migrate

Add BackThenTrait to your model like so.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Sukohi\BackThen\BackThenTrait;

class Product extends Model
{
    use BackThenTrait;

That's all.
Now when you create, update or delete record, this package automatically will save revision record(s).

Usage

You can save and delete record as usual like so.

$product = new \App\Product();
$product->name = 'xxxxxxx';
$product->save();   // Revision record will be saved.

$product = \App\Product::find(1);
$product->name = 'yyyyyyy';
$product->save();   // Revision record will be saved.

$product->delete();   // Revision record will be saved.

Save user ID

You can save ID of user who saved/deleted through revision_user_id.

$product = \App\Product::find(1);
$product->revision_user_id = 1; // User ID you want to save.
$product->save();

Retrieve Current Revision ID and Unique ID

echo $product->revision_id;
echo $product->revision_unique_id;

Change Revision

via changeRevisionById

$revision_id = 1;

if($product->hasRevisionId($revision_id)) {

    $product->changeRevisionById($revision_id); // This has old values.

}

or via changeRevision

$unique_id = '5a906ea1934196bc065f1b22eafd90c9';

if($product->hasRevisionUniqueId($unique_id)) {

    $product->changeRevision($unique_id); // This has old values.

}

Note: Once you call changeRevisionById() or changeRevision(), the model has old values.
This means if you save it, of cause, the latest value will be replaced with the old ones.
So don't forget to call clearRevision() if you need to save at the same time.

Return to the Latest Revision

$product->clearRevision();

Revision Columns

If you'd like this package to save specific revision record.
Set column names in your model like so.

protected $revisions = ['column_name'];

or

protected $ignore_revisions = ['column_name'];

Retrieve Revision data

$histories = $product->revisionHistory; // All revisions

or

$revision = $product->getRevisionById(1);   // A specific revision
$revision = $product->getRevision('5a906ea1934196bc065f1b22eafd90c9');// A specific revision

License

This package is licensed under the MIT License.

Copyright 2017 Sukohi Kuhoh


All versions of back-then with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ~5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sukohi/back-then contains the following files

Loading the files please wait ....