Skip to content

Instantly share code, notes, and snippets.

View amiriun's full-sized avatar

Amir Alian amiriun

  • Vienna, Austria
View GitHub Profile
Hello github :)
@amiriun
amiriun / helpers.php
Last active March 7, 2022 16:30
Translate Carbon Diff For Human Characters to Persian
<?php
function diffForHumans($time)
{
$get_en = \Carbon::createFromTimeStamp( $time )->diffForHumans();
$set_fa = str_replace('years','سال',$get_en);
$set_fa = str_replace('months','ماه',$set_fa);
$set_fa = str_replace('weeks','هفته',$set_fa);
$set_fa = str_replace('days','روز',$set_fa);
$set_fa = str_replace('hours','ساعت',$set_fa);