diff options
| author | horus | 2022-01-07 14:02:05 +0100 |
|---|---|---|
| committer | horus | 2022-01-07 14:02:12 +0100 |
| commit | 3fe0381d28d9c5844c82d908b77d3aa4b0aca737 (patch) | |
| tree | 2ce0641a2a78a2bfe84c6f576947279db6b68ad3 /app/Libraries/Helper.php | |
| parent | bb95c3083b20687dcea427351270f0d835598fdb (diff) | |
| download | kategorischeraperitif-3fe0381d28d9c5844c82d908b77d3aa4b0aca737.tar.gz | |
first release of kategorischeraperitif.de
Diffstat (limited to 'app/Libraries/Helper.php')
| -rw-r--r-- | app/Libraries/Helper.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/Libraries/Helper.php b/app/Libraries/Helper.php new file mode 100644 index 0000000..1e9741e --- /dev/null +++ b/app/Libraries/Helper.php @@ -0,0 +1,27 @@ +<?php +namespace App\Libraries; +use App\Libraries\Helper; +use Carbon\Carbon; + +class Helper { + public static function escapeLike($string){ + $search = array('%', '_'); + $replace = array('\%', '\_'); + $string = str_replace($search, $replace, $string); + $string = explode(" ", $string); + return implode("%", $string); + } + + public static function formatTimestamp($timestamp) { + return Carbon::createFromTimestamp($timestamp)->format("Y-m-d"); + } + + public static function contains($array, $str) { + foreach($array as $item) { + if ( str_contains(strtolower($str), strtolower($item) ) ) { + return true; + } + } + return false; + } +} |
