Skip to content

Instantly share code, notes, and snippets.

@ferdhika31
Created October 16, 2018 07:43
Show Gist options
  • Save ferdhika31/393f2b5d72f67c685604af19293889d7 to your computer and use it in GitHub Desktop.
Save ferdhika31/393f2b5d72f67c685604af19293889d7 to your computer and use it in GitHub Desktop.
Helper :)
<?php
/*
* @Author: Ferdhika Yudira
* @Website: http://dika.web.id
* @Date: 2018-09-27 11:46:55
* @Email: fer@dika.web.id
*/
namespace App\Helpers;
use Illuminate\Support\Facades\URL;
class Generate{
public static function url($link){
$link = str_replace('[base_url]', URL::to('/'), $link);
return $link;
}
public static function imgFromHtml($html){
preg_match_all( '@src="([^"]+)"@' , $html, $match );
$src = array_pop($match);
return $src;
}
public static function namaUrl($nama){
$nama = str_replace(' ', '-', strtolower($nama));
// $nama = preg_replace('/[^A-Za-z0-9\-]/', '', $nama);
return $nama;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment