public static function slugify($text, string $divider = '-')
{
// replace non letter or digits by divider
$text = preg_replace('~[^\pL\d]+~u', $divider, $text);

// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);

// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);

// trim
$text = trim($text, $divider);

// remove duplicate divider
$text = preg_replace('~-+~', $divider, $text);

// lowercase
$text = strtolower($text);

if (empty($text)) {
return 'n-a';
}

return $text;
}

Phone code

substr_replace('62',ltrim($kontak->telepon, '0'),2)

--

--

Update multi | Value::where(‘project_id’, $id)->update([‘data’=>$data]);

Polymorphic WhereHas

Model

public function bills()
{
return $this->belongsTo(Bill::class, 'sponsorable_id')
->whereSponsorableType(Bill::class);
}public function lists()
{
return $this->belongsTo(List::class, 'sponsorable_id')
->whereSponsorableType(List::class);
}

Eloquent

Sponsorable::with('sponsorable')
->whereHas('bills', function ($query) use ($term) {
$query->where([
'term_id' => $term->id
]);
})->orWhereHas('lists', function ($query) use ($term) {
$query->where([
'term_id' => $term->id
]);
})->get()
{{ app('request')->input('a') }} / {{ Request::get('a') }}

--

--