Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 631 Bytes

README.md

File metadata and controls

19 lines (17 loc) · 631 Bytes

Unique URL Alias

Convert a text to a url-friendly text, plus check for the uniqueness of it.

Usage

    $alias = UrlHelper::alias('My Post Name', function($alias) {
        /*
        * A function which queries the database and gets
        * the users' count which match the alias.
        * If the count is positive, means there are already rows
        * with the current alias, so the function returns false,
        * otherwise returns true.
        * Change the code below with your own checking mechanism.
        */
        return !(bool)DB::Model_User::getByAlias($alias)->count();
    });