2017 © Pedro Peláez
 

library eloquent-tokenable

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

image

kduma/eloquent-tokenable

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  • Friday, May 19, 2017
  • by kduma
  • Repository
  • 1 Watchers
  • 6 Stars
  • 90 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 8 Versions
  • 3 % Grown

The README.md

L5-eloquent-tokenable

Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight StyleCI, (*1)

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models., (*2)

Setup

Add the package to the require section of your composer.json and run composer update, (*3)

"kduma/eloquent-tokenable": "^1.1"

Prepare models

In your model add following lines:, (*4)

use \KDuma\Eloquent\Tokenable;
protected $appends = array('token');

Optionally you can add also:, (*5)

  • protected $salt = 'SALT';
    A salt for making hashes. Default is table name. This salt is added to your APP_KEY., (*6)

  • protected $length = 10;
    A salt length. Default is 10., (*7)

  • protected $alphabet = 'qwertyuiopasdfghjklzxcvbnm1234567890';
    A hash alphabet. Default is abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890, (*8)

Usage

  • $model->token - Generate tokens
  • Model::whereToken($id)->first() - Find by token. (whereToken is query scope)

Hashids

A special thanks to creators of hashids, a PHP class that this package is based., (*9)

Packagist

View this package on Packagist.org: kduma/eloquent-tokenable, (*10)

The Versions

19/05 2017

dev-master

9999999-dev

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

19/05 2017

v1.1.1

1.1.1.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

21/10 2016

dev-analysis-zGJ4QE

dev-analysis-zGJ4QE

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

09/06 2015

v1.1.0

1.1.0.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

31/01 2015

v1.0.3

1.0.3.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

31/01 2015

v1.0.2

1.0.2.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

31/01 2015

v1.0.1

1.0.1.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

31/01 2015

v1.0.0

1.0.0.0

Allows using tokens (HashIDs) instead of id in Laravel Eloquent models.

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids