blob: 1e9741ebbce5f0cdbe0507eccd3283b8178041ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}
}
|