Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/*
* 現在日付の和暦を表示
*/
Blade::extend(function($view, $compiler)
{
$pattern = $compiler->createMatcher('now_y');
$now_year = date('Y');
$japanese_calender_year = $now_year - 1988;
return preg_replace($pattern, '<?php echo date("'.$japanese_calender_year.'") ?>', $view);
});
/*
* 現在日付の月を表示
*/
Blade::extend(function($view, $compiler)
{
$pattern = $compiler->createMatcher('now_m');
return preg_replace($pattern, '<?php echo date("n") ?>', $view);
});
/*
* 現在日付の日を表示
*/
Blade::extend(function($view, $compiler)
{
$pattern = $compiler->createMatcher('now_d');
return preg_replace($pattern, '<?php echo date("j") ?>', $view);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.