{"id":10723,"date":"2022-07-11T07:00:51","date_gmt":"2022-07-10T22:00:51","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=10723"},"modified":"2022-06-29T19:14:44","modified_gmt":"2022-06-29T10:14:44","slug":"%e6%b0%97%e6%b8%a9%e5%a4%89%e5%8c%96%e3%82%92%e7%9b%a3%e8%a6%96%e3%81%97%e3%81%a6%e7%86%b1%e4%b8%ad%e7%97%87%e3%82%a2%e3%83%a9%e3%83%bc%e3%83%a0%e3%83%bb%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%92%e9%80%81","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=10723","title":{"rendered":"\u6c17\u6e29\u5909\u5316\u3092\u76e3\u8996\u3057\u3066\u71b1\u4e2d\u75c7\u30a2\u30e9\u30fc\u30e0\u30fb\u30e1\u30fc\u30eb\u3092\u9001\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u590f\u751f\u307e\u308c\u306a\u306e\u3067\u3059\u304c\u3001\u5e74\u3092\u8ffd\u3046\u3054\u3068\u306b\u5c11\u3057\u305a\u3064\u82e6\u624b\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u590f\u306e\u6691\u3055\ud83c\udf05<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u304a\u305d\u3089\u304f\u6c17\u5019\u5909\u52d5\u306e\u5f71\u97ff\u3082\u3042\u3063\u3066\u590f\u306e\u6c17\u6e29\u304c\u9ad8\u304f\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u3063\u3066\u3001\u3055\u3059\u304c\u306b\u6700\u8fd1\u306f\u30a8\u30b0\u3044\u3053\u3068\u306b\u306a\u3063\u3066\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u306a\u304a\u3001\u305d\u3093\u306a\u300c<strong>\u6691\u3044\u306a\u2026<\/strong>\u300d\u3068\u3044\u3046\u66d6\u6627\u306a\u3053\u3068\u306f\u5206\u304b\u308b\u3093\u3067\u3059\u3051\u3069\u3001\u306a\u305c\u304b\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u3069\u308c\u3050\u3089\u3044\u306e\u30ec\u30d9\u30eb\u3067\u6691\u3044\u304b\uff1f<\/strong><\/p>\n<p>\u304c\u76f4\u611f\u3067\u5206\u304b\u3089\u306a\u3044\u3093\u3067\u3059\u3002\uff08\u3046\u30fc\u3093\u3001\u5b50\u4f9b\u306e\u9803\u306b\u5916\u3067\u904a\u3073\u904e\u304e\u3066\u6e29\u5ea6\u611f\u899a\u304c\u9ebb\u75fa\u3057\u3061\u3083\u3063\u305f\u306e\u304b\u3082\u3067\u3059\ud83d\ude02\uff09<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>Laravel<\/code>\u3092\u4f7f\u3063\u3066\u3001<code>28\u2103<\/code>\u3092\u8d85\u3048\u305f\u3089\u300c<strong>\u71b1\u4e2d\u75c7\u30a2\u30e9\u30fc\u30e0<\/strong>\u300d\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3067\u304d\u308b\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/>\u300c\u8fd1\u304f\u306b\u300e\u30ac\u30c4\u30f3\u3068\u307f\u304b\u3093\u300f<br \/>\n\u304c\u58f2\u3063\u3066\u306a\u3044\u2026\u300d<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u4eca\u56de\u3084\u308a\u305f\u3044\u3053\u3068\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u6c17\u6e29\u304c 28\u2103 \u3092\u8d85\u3048\u305f\u3089\u300c\u71b1\u4e2d\u75c7\u30a2\u30e9\u30fc\u30e0\u300d\u30e1\u30fc\u30eb\u3092\u9001\u4fe1<\/li>\n<li>\u4f55\u56de\u3082\u901a\u77e5\u304c\u6765\u305f\u3089\u3046\u3063\u3068\u304a\u3057\u3044\u306e\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u5f8c\uff13\u6642\u9593\u306f\u30e1\u30fc\u30eb\u3057\u306a\u3044<\/li>\n<li>\u5bdd\u3066\u308b\u6642\u306b\u30e1\u30fc\u30eb\u304c\u6765\u305f\u3089\u3046\u3063\u3068\u304a\u3057\u3044\u306e\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u306a\u3044<\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u4f5c\u696d\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>OpenWeatherMap API \u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u3001\u5929\u6c17\u60c5\u5831\u306f <strong><a href=\"https:\/\/openweathermap.org\/api\" target=\"_blank\" rel=\"noopener\">OpenWeatherMap API<\/a> <\/strong>\u3092\u4f7f\u3044\u307e\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066\u300c<strong>API \u30ad\u30fc<\/strong>\u300d\u3092\u53d6\u5f97\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=6722#OpenWeatherMap\" target=\"_blank\" rel=\"noopener\">OpenWeatherMap\u306b\u767b\u9332\u3059\u308b<\/a><\/p>\n<p>\u305d\u3057\u3066\u3001API \u30ad\u30fc\u3092\u53d6\u5f97\u3057\u305f\u3089<code>.env<\/code>\u3078\u30bb\u30c3\u30c8\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>.env<\/strong><\/p>\n<pre><strong>OPEN_WEATHER_MAP_API=*******************<\/strong><\/pre>\n<h1>\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3088\u308a\u3082\u5148\u306b\u300c<strong>\u71b1\u4e2d\u75c7\u3001\u8981\u6ce8\u610f\u2757<\/strong>\u300d\u30e1\u30fc\u30eb\u304c\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Mailable \u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u306f\u3001<code>Laravel<\/code>\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u969b\u306b\u4fbf\u5229\u306a<code>Mailable<\/code>\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:mail TemperatureExceeded<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u6b21\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Mail\/TemperatureExceeded.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Mail;\r\n\r\nuse Illuminate\\Bus\\Queueable;\r\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\r\nuse Illuminate\\Mail\\Mailable;\r\nuse Illuminate\\Queue\\SerializesModels;\r\n\r\nclass TemperatureExceeded extends Mailable\r\n{\r\n    use Queueable, SerializesModels;\r\n\r\n    <strong>private $threshold_temperature;<\/strong>\r\n<strong>    private $current_temperature;<\/strong>\r\n\r\n<strong>    public function __construct($threshold_temperature, $current_temperature)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $this-&gt;threshold_temperature = $threshold_temperature;<\/strong>\r\n<strong>        $this-&gt;current_temperature = $current_temperature;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function build()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $subject = '\u3010\u71b1\u4e2d\u75c7\u30a2\u30e9\u30fc\u30c8\u3011';<\/strong>\r\n<strong>        $from = 'from@example.com';<\/strong>\r\n\r\n<strong>        return $this<\/strong>\r\n<strong>            -&gt;from($from, config('app.name'))<\/strong>\r\n<strong>            -&gt;subject($subject)<\/strong>\r\n<strong>            -&gt;view('emails.temperature_exceeded', [<\/strong>\r\n<strong>                'threshold_temperature' =&gt; $this-&gt;threshold_temperature,<\/strong>\r\n<strong>                'current_temperature' =&gt; $this-&gt;current_temperature,<\/strong>\r\n<strong>            ]);<\/strong>\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<h2>\u30e1\u30fc\u30eb\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff08\u30d3\u30e5\u30fc\uff09\u3092\u3064\u304f\u308b<\/h2>\n<p>\u6b21\u306b\u3001\u5148\u307b\u3069\u306e<code>TemperatureExceeded<\/code>\u3067\u8a2d\u5b9a\u3057\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff08\u30d3\u30e5\u30fc\uff09\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\uff08\u3064\u307e\u308a\u30e1\u30fc\u30eb\u306e\u6587\u9762\u3067\u3059\u306d\ud83d\udc4d\uff09<\/p>\n<p><strong>resources\/views\/emails\/temperature_exceeded.blade.php<\/strong><\/p>\n<pre><strong>&lt;h3&gt;\u6c17\u6e29\u304c {{ $threshold_temperature }} \u2103 \u3092\u8d85\u3048\u307e\u3057\u305f\u3002\uff08\u73fe\u5728\uff1a {{ $current_temperature }}\u2103\uff09&lt;\/h3&gt;<\/strong>\r\n<strong>\u96fb\u6c17\u4ee3\u306f\u6c17\u306b\u305b\u305a\u30af\u30fc\u30e9\u30fc\u3064\u3051\u3088\u3046\uff01&lt;br&gt;<\/strong>\r\n<strong>\u71b1\u4e2d\u75c7\u306b\u306a\u3063\u305f\u3089\u3082\u3063\u3068\u304a\u91d1\u304b\u304b\u308b\u3088 &amp;#x1F62D;<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u90e8\u5206\u306f\u5b8c\u4e86\u3067\u3059\u2757<\/p>\n<h1>\u6e29\u5ea6\u3092\u76e3\u8996\u3059\u308b\u72ec\u81ea Artisan \u30b3\u30de\u30f3\u30c9\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u984c\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\uff11\u6642\u9593\u3054\u3068\u306b\u6e29\u5ea6\u3092\u30c1\u30a7\u30c3\u30af\u3057\u305f\u3044\u306e\u3067\u3001\u30bf\u30a4\u30de\u30fc\u5b9f\u884c\u3057\u3084\u3059\u3044\u72ec\u81ea<code>Artisan<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:command CheckTemperatureCommand<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Console\/Commands\/CheckTemperatureCommand.php<\/strong><\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Console\\Commands;\r\n\r\n<strong>use App\\Mail\\TemperatureExceeded;<\/strong>\r\n<strong>use Carbon\\Carbon;<\/strong>\r\nuse Illuminate\\Console\\Command;\r\n<strong>use Illuminate\\Support\\Arr;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Http;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Mail;<\/strong>\r\n\r\nclass CheckTemperatureCommand extends Command\r\n{\r\n    <strong>\/\/ \u5929\u6c17\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u5834\u6240\uff08\u6771\u4eac\u30b9\u30ab\u30a4\u30c4\u30ea\u30fc\uff09<\/strong>\r\n<strong>    const LATITUDE = '35.710079006659114';<\/strong>\r\n<strong>    const LONGITUDE = '139.8106985886275';<\/strong>\r\n<strong>    const TO_EMAIL_ADDRESS = 'to@example.com';<\/strong>\r\n<strong>    protected $signature = 'check:temperature<\/strong>\r\n<strong>                            {--threshold=28 : The temperature threshold}<\/strong>\r\n<strong>                            {--start=7:00 : The start time}<\/strong>\r\n<strong>                            {--end=23:00 : The end time}<\/strong>\r\n<strong>                            {--ignore=3 : The number of hours to ignore}';<\/strong>\r\n<strong>    protected $description = 'Check temperature';<\/strong>\r\n\r\n<strong>    public function handle()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $threshold_temperature = intval($this-&gt;option('threshold'));<\/strong>\r\n<strong>        $ignore_hours = intval($this-&gt;option('ignore'));<\/strong>\r\n<strong>        $start_dt = new Carbon($this-&gt;option('start'));<\/strong>\r\n<strong>        $end_dt = new Carbon($this-&gt;option('end'));<\/strong>\r\n<strong>        $now = now();<\/strong>\r\n\r\n<strong>        \/\/ \u6642\u9593\u30c1\u30a7\u30c3\u30af<\/strong>\r\n<strong>        if(! $now-&gt;between($start_dt, $end_dt)) {<\/strong>\r\n\r\n<strong>            $this-&gt;info('\u6709\u52b9\u6642\u9593\u5916\u3067\u3059');<\/strong>\r\n<strong>            return Command::SUCCESS;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        \/\/ \u6e29\u5ea6\u3092\u53d6\u5f97<\/strong>\r\n<strong>        $current_temperature = $this-&gt;getTemperature();<\/strong>\r\n\r\n<strong>        if(is_null($current_temperature)) {<\/strong>\r\n\r\n<strong>            $this-&gt;error('\u6c17\u6e29\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f');<\/strong>\r\n<strong>            return Command::FAILURE;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        \/\/ \u6761\u4ef6\u304c\u5408\u3048\u3070\u30e1\u30fc\u30eb\u9001\u4fe1<\/strong>\r\n<strong>        $last_email_date_time = cache('last_email_date_time');<\/strong>\r\n\r\n<strong>        if(is_null($last_email_date_time) || $now-&gt;diffInHours($last_email_date_time) &gt; $ignore_hours) { \/\/ \u57fa\u6e96\u6642\u9593\u4ee5\u4e0a\u7d4c\u904e\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30e1\u30fc\u30eb\u9001\u4fe1\u53ef<\/strong>\r\n\r\n<strong>            if($current_temperature &gt; $threshold_temperature) { \/\/ \u6e29\u5ea6\u304c\u57fa\u6e96\u3092\u8d85\u3048\u305f\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af<\/strong>\r\n\r\n<strong>                $this-&gt;info('\u6c17\u6e29\u304c\u57fa\u6e96\u3092\u8d85\u3048\u307e\u3057\u305f');<\/strong>\r\n<strong>                $this-&gt;sendEmail($current_temperature);<\/strong>\r\n\r\n<strong>                cache(['last_email_date_time' =&gt; $now]);<\/strong>\r\n\r\n<strong>            } else {<\/strong>\r\n\r\n<strong>                $this-&gt;info('\u6c17\u6e29\u306f\u57fa\u6e96\u5185\u3067\u3059');<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        } else {<\/strong>\r\n\r\n<strong>            $this-&gt;info('\u30e1\u30fc\u30eb\u9001\u4fe1\u5f8c\u3001\u6642\u9593\u304c\u7d4c\u904e\u3057\u3066\u3044\u307e\u305b\u3093');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return Command::SUCCESS;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    private function getTemperature()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $temperature = null;<\/strong>\r\n<strong>        $api_key = env('OPEN_WEATHER_MAP_API'); \/\/ \u672c\u6765\u306f\u30b3\u30f3\u30d5\u30a3\u30b0\u306b\u767b\u9332\u3059\u3079\u304d\u3067\u3059<\/strong>\r\n<strong>        $url = 'https:\/\/api.openweathermap.org\/data\/2.5\/weather?'.<\/strong>\r\n<strong>            'lat='. self::LATITUDE .'&amp;'.<\/strong>\r\n<strong>            'lon='. self::LONGITUDE .'&amp;'.<\/strong>\r\n<strong>            'appid='. $api_key .'&amp;'.<\/strong>\r\n<strong>            'units=metric';<\/strong>\r\n<strong>        $response = Http::get($url);<\/strong>\r\n\r\n<strong>        if($response-&gt;ok()) {<\/strong>\r\n\r\n<strong>            $data = $response-&gt;json();<\/strong>\r\n<strong>            $temperature = Arr::get($data, 'main.temp');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        if(! is_null($temperature)) {<\/strong>\r\n\r\n<strong>            return intval(<\/strong>\r\n<strong>                round($temperature) \/\/ \u5c0f\u6570\u70b9\u4ee5\u4e0b\u3092\u56db\u6368\u4e94\u5165<\/strong>\r\n<strong>            );<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return null;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    private function sendEmail($current_temperature)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $to = self::TO_EMAIL_ADDRESS;<\/strong>\r\n<strong>        $threshold_temperature = intval($this-&gt;option('threshold'));<\/strong>\r\n\r\n<strong>        Mail::to($to)-&gt;send(<\/strong>\r\n<strong>            new TemperatureExceeded($threshold_temperature, $current_temperature)<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u304c\u3044\u304f\u3064\u304b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<br \/>\n\u3068\u3044\u3046\u306e\u3082\u3001\u30a2\u30e9\u30fc\u30e0\u30e1\u30fc\u30eb\u306e\u53d6\u5f97\u306f\u304a\u597d\u307f\u3067\u6570\u5b57\u3084\u6642\u9593\u3092\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3072\u3068\u3064\u305a\u3064\u5185\u5bb9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<ul>\n<li>&#8211;threshold\uff1a \u4f55\u5ea6\u3092\u8d85\u3048\u305f\u3089\u30e1\u30fc\u30eb\u3092\u9001\u308b\u304b\uff1f\u30c7\u30d5\u30a9\u30eb\u30c8\u306f 28\u2103<\/li>\n<li>&#8211;start\uff1a \u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u8a31\u53ef\u3059\u308b\u958b\u59cb\u6642\u9593\uff08\u5bdd\u3066\u308b\u6642\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u306a\u3044\u305f\u3081\uff09\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u300c7:00\u300d<\/li>\n<li>&#8211;end\uff1a \u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u8a31\u53ef\u3059\u308b\u7d42\u4e86\u6642\u9593\uff08\u4e0a\u3068\u540c\u3058\uff09\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u3001\u300c23:00\u300d<\/li>\n<li>&#8211;ignore\uff1a \u4e00\u56de\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u305f\u3089\u305d\u306e\u5f8c\u4f55\u6642\u9593\u9001\u4fe1\u3057\u306a\u3044\u304b\uff08\u6bce\u6642\u9593\u3054\u3068\u306b\u304f\u308b\u3068\u3046\u3063\u3068\u304a\u3057\u3044\u306e\u3067\uff09\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\uff13\u6642\u9593<\/li>\n<\/ul>\n<h1>Cron \u3067\u30bf\u30a4\u30de\u30fc\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001<code>php artisan check:temperature<\/code>\u304c<code>crontab<\/code>\u3067\u30bf\u30a4\u30de\u30fc\u3059\u308b\u3084\u308a\u65b9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u74b0\u5883\u306b\u3088\u308a\u9055\u3063\u3066\u304d\u307e\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u6bce\u6642\u9593\u3054\u3068\u306b\u4eca\u56de\u3064\u304f\u3063\u305f\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"code-helper code-helper-27 hljs markdown\"><strong><span class=\"hljs-bullet\">0<\/span> <span class=\"hljs-emphasis\">* *<\/span> <span class=\"hljs-emphasis\">* *<\/span> \/usr\/bin\/php \/PATH\/TO\/YOUR\/LARAVEL\/artisan check:temperature<\/strong><\/pre>\n<p>\u30b5\u30f3\u30d7\u30eb\u306f\u6bce\u66420\u5206\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u306a\u304a\u3001\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u306f\u57fa\u6e96\u306e\u6c17\u6e29\uff0828\u2103\uff09\u3092\u8d85\u3048\u3066\u3044\u306a\u3044\u3068\u30e1\u30fc\u30eb\u9001\u4fe1\u3055\u308c\u306a\u3044\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7d76\u5bfe\u306b50\u2103\uff08\u71b1\u6ce2\u2026\ud83d\ude2b\uff09\u304c\u53d6\u5f97\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>private function getTemperature()\r\n{\r\n    <strong>return 50; \/\/ TEST: <\/strong>\r\n\r\n    \/\/ \u4ee5\u4e0b\u7701\u7565<\/pre>\n<p>\u3067\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan check:temperature<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10736\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_1.png\" alt=\"\" width=\"212\" height=\"28\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u6c17\u6e29\u304c\u8d85\u3048\u305f\u3068\u5224\u5225\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30e1\u30fc\u30eb\u306e\u65b9\u3082\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3069\u3046\u306a\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10737\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_2.png\" alt=\"\" width=\"399\" height=\"202\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_2.png 399w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_2-300x152.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u3046\u307e\u304f\u30e1\u30fc\u30eb\u304c\u5c4a\u304d\u307e\u3057\u305f\ud83d\ude04<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u300c<strong>\u4e00\u56de\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u305f\u3089\u3001\uff13\u6642\u9593\u306f\u8ffd\u52a0\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u306a\u3044<\/strong>\u300d\u6a5f\u80fd\u304c\u3046\u307e\u304f\u3044\u3063\u3066\u3044\u308b\u304b\u78ba\u304b\u3081\u3066\u898b\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u306e\u307e\u307e\u540c\u3058\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u3046\u307e\u304f\u3044\u304f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10738\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_3.png\" alt=\"\" width=\"333\" height=\"28\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_3.png 333w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_temperature_alarm_email_3-300x25.png 300w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u30e1\u30fc\u30eb\u9001\u4fe1\u306f\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u5168\u3066\u6210\u529f\u3067\u3059\u2728\ud83d\ude04\ud83d\udc4d<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b\u3001<code>API<\/code>\u3068\u30bf\u30a4\u30de\u30fc\u5b9f\u884c\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3044\u308d\u3044\u308d\u3068\u4fbf\u5229\u306a\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<\/p>\n<ul>\n<li>\u682a\u4fa1\u3092\u76e3\u8996\u3057\u3066\u3001\u72ec\u81ea\u306e\u58f2\u8cb7\u30a2\u30e9\u30fc\u30e0\u3092\u3064\u304f\u308b<\/li>\n<li>\u5929\u6c17\u3092\u76e3\u8996\u3057\u3066\u3001\u81ea\u52d5\u3067\u5272\u5f15\u30bb\u30fc\u30eb\u5185\u5bb9\u3092\u5207\u308a\u66ff\u3048\u308b<\/li>\n<li>\u96fb\u8eca\u306e\u9045\u5ef6\u60c5\u5831\u3092\u76e3\u8996\u3057\u3066\u3001\u793e\u54e1\u5168\u54e1\u306b\u901a\u77e5\u3057\u3066\u3042\u3052\u308b<\/li>\n<li>\u53f0\u98a8\u767a\u751f\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u3001\u4e88\u671f\u305b\u306c\u30ea\u30b9\u30af\u306b\u5099\u3048\u308b\u3088\u3046\u901a\u77e5\u3059\u308b<\/li>\n<\/ul>\n<p>\u306a\u3069\u306a\u3069\u3002<\/p>\n<p>\u305c\u3072\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u3088\u308a\u3054\u9023\u7d61\u304f\u3060\u3055\u3044\u3002<br \/>\n\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3067\u300c<strong>\u71b1\u4e2d\u75c7\u3001\u8981\u6ce8\u610f\u2757<\/strong>\u300d\u30e1\u30fc\u30eb\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><code>API<\/code>\u306f\u7a81\u7136\u7d42\u4e86\u3057\u3066\u3057\u307e\u3046\u30ea\u30b9\u30af\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u30db\u30f3\u30c8\u306b\u7c21\u5358\u306b\u3044\u308d\u3093\u306a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306b\u4f55\u304b\u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f\u304a\u3059\u3059\u3081\u3067\u3059\ud83d\udc4d<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3082\u3061\u308d\u3093\u6e29\u5ea6\u8a2d\u5b9a\u3092\u5909\u3048\u3066\u300c\u98a8\u90aa\u3072\u3044\u3061\u3083\u3046\u304b\u3089\u6696\u623f\u5165\u308c\u3088\u3046\u2757\u300d\u30e1\u30fc\u30eb\u3084\u300c\u4e7e\u71e5\u808c\u6ce8\u610f\u5831\u300d\u306a\u3069\u3082\u3067\u304d\u307e\u3059\u3057\u3001\u30c7\u30fc\u30bf\u3055\u3048\u53d6\u5f97\u3067\u304d\u308b\u306a\u3089\u300c\u82b1\u7c89\u306b\u6ce8\u610f\u30e1\u30fc\u30eb\u300d\u306a\u3069\u3082\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u590f\u4f11\u307f\u306e\u5de5\u4f5c\u7684\u306b\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8777 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/03\/no_15.png\" alt=\"\" width=\"338\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/03\/no_15.png 338w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/03\/no_15-300x284.png 300w\" sizes=\"auto, (max-width: 338px) 100vw, 338px\" \/>\u300cSafari \u3063\u3066<br \/>\nChrome \u3068\u307b\u307c\u4e00\u7dd2\u2026<br \/>\n\u3063\u3066\u601d\u3063\u3061\u3083\u30c0\u30e1\u3067\u3057\u305f\ud83d\ude02\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u590f\u751f\u307e\u308c\u306a\u306e\u3067\u3059\u304c\u3001\u5e74\u3092\u8ffd\u3046\u3054\u3068\u306b\u5c11\u3057\u305a\u3064\u82e6\u624b\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb \u590f\u306e\u6691\u3055\ud83c\udf05 \u3067\u3059\u3002 \u304a\u305d\u3089\u304f\u6c17\u5019\u5909\u52d5\u306e\u5f71\u97ff\u3082\u3042 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=10723\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u6c17\u6e29\u5909\u5316\u3092\u76e3\u8996\u3057\u3066\u71b1\u4e2d\u75c7\u30a2\u30e9\u30fc\u30e0\u30fb\u30e1\u30fc\u30eb\u3092\u9001\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":10742,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-10723","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10723"}],"version-history":[{"count":15,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10723\/revisions"}],"predecessor-version":[{"id":10744,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10723\/revisions\/10744"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/10742"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}