From 12d06dc88b0d1eaac6849b3b9847aba600da67fb Mon Sep 17 00:00:00 2001 From: shibafu Date: Sat, 9 Sep 2017 02:10:51 +0900 Subject: [PATCH] =?UTF-8?q?=E6=A6=82=E6=B3=81=E6=AC=84=E3=81=AE=E6=99=82?= =?UTF-8?q?=E9=96=93=E8=A1=A8=E8=A8=98=E3=81=8C=E7=8B=82=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=81=9F=E3=82=81=E3=80=81=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=BC=E3=83=9E=E3=83=83=E3=83=88=E3=81=AE=E6=8B=85=E5=BD=93?= =?UTF-8?q?=E3=82=92DB=E3=81=8B=E3=82=89PHP=E3=81=AB=E7=A7=BB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Facades/Formatter.php | 13 +++++++++ app/Http/Controllers/HomeController.php | 10 +++---- app/Http/Controllers/UserController.php | 10 +++---- app/Providers/FormatterServiceProvider.php | 31 ++++++++++++++++++++++ app/Utilities/Formatter.php | 19 +++++++++++++ config/app.php | 1 + resources/views/home.blade.php | 8 +++--- resources/views/user/profile.blade.php | 8 +++--- 8 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 app/Facades/Formatter.php create mode 100644 app/Providers/FormatterServiceProvider.php create mode 100644 app/Utilities/Formatter.php diff --git a/app/Facades/Formatter.php b/app/Facades/Formatter.php new file mode 100644 index 0000000..ed43178 --- /dev/null +++ b/app/Facades/Formatter.php @@ -0,0 +1,13 @@ +app->singleton(Formatter::class, function ($app) { + return new Formatter(); + }); + } +} diff --git a/app/Utilities/Formatter.php b/app/Utilities/Formatter.php new file mode 100644 index 0000000..bb87a61 --- /dev/null +++ b/app/Utilities/Formatter.php @@ -0,0 +1,19 @@ + Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, + 'Formatter' => App\Facades\Formatter::class, ], ]; diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index dcea823..e8b45e8 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -31,10 +31,10 @@ @if (isset($summary) && $summary[0]->total_checkins > 0)

assessment概況

-

平均記録: {{ $summary[0]->average }}

-

最長記録: {{ $summary[0]->longest }}

-

最短記録: {{ $summary[0]->shortest }}

-

合計時間: {{ $summary[0]->total_times }}

+

平均記録: {{ Formatter::formatInterval($summary[0]->average) }}

+

最長記録: {{ Formatter::formatInterval($summary[0]->longest) }}

+

最短記録: {{ Formatter::formatInterval($summary[0]->shortest) }}

+

合計時間: {{ Formatter::formatInterval($summary[0]->total_times) }}

通算回数: {{ $summary[0]->total_checkins }}回

@endif diff --git a/resources/views/user/profile.blade.php b/resources/views/user/profile.blade.php index 3c9bf4e..521aa4a 100644 --- a/resources/views/user/profile.blade.php +++ b/resources/views/user/profile.blade.php @@ -39,10 +39,10 @@ @if (isset($summary) && $summary[0]->total_checkins > 0)

assessment概況

-

平均記録: {{ $summary[0]->average }}

-

最長記録: {{ $summary[0]->longest }}

-

最短記録: {{ $summary[0]->shortest }}

-

合計時間: {{ $summary[0]->total_times }}

+

平均記録: {{ Formatter::formatInterval($summary[0]->average) }}

+

最長記録: {{ Formatter::formatInterval($summary[0]->longest) }}

+

最短記録: {{ Formatter::formatInterval($summary[0]->shortest) }}

+

合計時間: {{ Formatter::formatInterval($summary[0]->total_times) }}

通算回数: {{ $summary[0]->total_checkins }}回

@endif