Laravelのアプリケーション全体でCarbonImmutableを使用したい
はじめに
こんにちは。Laravelで日に日に新しいもの出てきて(見つけて)、追いつくのに必死の筆者です
さて、Carbon
使っていますでしょうか?
Eloquentの返り値等々、CarbonImmutable
だったらいいなと感じました。
CarbonImmutableにできます
AppServiceProviderにたった1行書くだけ
AppServiceProvider.php
class AppServiceProvider extends ServiceProvider
{
public function register()
{
// アプリケーション全体でCarbonImmutableを使用する.
DateFactory::use(\Carbon\CarbonImmutable::class);
}
}
おわりに
業務委託でぼそっと言われたのをしれっと対応した備忘録でした
それでは!
Author And Source
この問題について(Laravelのアプリケーション全体でCarbonImmutableを使用したい), 我々は、より多くの情報をここで見つけました https://qiita.com/akitkat/items/fc665117f430904d22e9著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .