generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from anuzpandey/dev
🔨 fix: memory exhaustion issue with recursive call.
- Loading branch information
Showing
7 changed files
with
104 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Anuzpandey\LaravelNepaliDate\Mixin; | ||
|
||
use Anuzpandey\LaravelNepaliDate\LaravelNepaliDate; | ||
use Carbon\Carbon; | ||
use Closure; | ||
|
||
/** | ||
* @mixin Carbon | ||
*/ | ||
class NepaliDateMixin | ||
{ | ||
|
||
public function toNepaliDate(): Closure | ||
{ | ||
return function (?string $format = 'Y-m-d', ?string $locale = 'np') { | ||
$date = $this->toDateString(); | ||
|
||
return LaravelNepaliDate::from($date)->toNepaliDate($format, $locale); | ||
}; | ||
} | ||
|
||
|
||
public function toEnglishDate(): Closure | ||
{ | ||
return function (?string $format = 'Y-m-d', ?string $locale = 'en') { | ||
$date = $this->toDateString(); | ||
|
||
return LaravelNepaliDate::from($date)->toEnglishDate($format, $locale); | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters