PHP Classes

File: src/Helper.php

Recommend this page to a friend!
  Classes of Moamen Eltouny   Laravel Short URL Generator   src/Helper.php   Download  
File: src/Helper.php
Role: Auxiliary script
Content type: text/plain
Description: Short URL function
Class: Laravel Short URL Generator
Generate and expand short URL stored in a database
Author: By
Last change:
Date: 3 years ago
Size: 273 bytes
 

Contents

Class file image Download
<?php

use Pharaonic\Laravel\ShortURL\ShortURL;

/**
 * Short URL (Get OR New)
 *
 * @param string|null $code
 * @return ShortURL
 */
function shortURL(string $code = null) {
    if(!empty(
$code)) return ShortURL::where('code', $code)->first();

    return new
ShortURL;
}