2017 © Pedro Peláez
 

library eloquent-tokenable

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

image

nanokaweb/eloquent-tokenable

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

  • Tuesday, February 16, 2016
  • by nanokaweb
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

L5-eloquent-tokenable

Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight, (*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

16/02 2016

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

laravel eloquent hashids

16/02 2016

1.2.0

1.2.0.0

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