2017 © Pedro Peláez
 

package attribute-slugging

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

image

larapack/attribute-slugging

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  • Thursday, December 17, 2015
  • by marktopper
  • Repository
  • 1 Watchers
  • 3 Stars
  • 122 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 6 % Grown

The README.md

attribute-slugging

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save., (*1)

Installing

Install using Composer composer require larapack/attribute-slugging 1.*., (*2)

Usage

First add the trait Sluggable to your Eloquent Model., (*3)

<?php

namespace App;

use Larapack\AttributeSlugging\Sluggable;

class User
{
  use Sluggable;

  /**
   * @var array List of attribute names which should be slugged
   */ 
  protected $slug = [
    'username_slug' => 'username', // set the attribute names you which to slug and from what attribute it should be generated from
  ];

  //...
}

Test:, (*4)

// we make two user objects
$userA = new App\User;
$userB = new App\User;
// then we set both username's to "Mark"
$userA->username = "Mark";
$userB->username = "Mark";
// save both objects
$userA->save();
$userB->save();
// now the unique slugs have been set
echo $userA->username_slug; // outputs "mark"
echo $userB->username_slug; // outputs "mark-2"

The Versions

17/12 2015

dev-develop

dev-develop

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

09/12 2015

dev-master

9999999-dev

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

09/12 2015

v1.0.3

1.0.3.0

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

30/11 2015

1.0.x-dev

1.0.9999999.9999999-dev

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

30/11 2015

v1.0.2

1.0.2.0

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

30/11 2015

v1.0.1

1.0.1.0

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging

27/11 2015

v1.0.0

1.0.0.0

Allows your Eloquent Model to automatically generate a unique slug for a attribute on save.

  Sources   Download

MIT

laravel package slug attribute larapack slugging