{"id":2955,"date":"2018-09-27T09:00:35","date_gmt":"2018-09-27T00:00:35","guid":{"rendered":"https:\/\/alaki.co.jp\/blog\/?p=2955"},"modified":"2020-08-11T23:14:59","modified_gmt":"2020-08-11T14:14:59","slug":"laravel5-6%e3%81%a7%e3%80%81cron%e7%94%a8%e3%83%90%e3%83%83%e3%83%81%e5%87%a6%e7%90%86%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/test.alaki.co.jp\/blog\/?p=2955","title":{"rendered":"Laravel5.6\u3067\u3001cron\u7528\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002<\/p>\n<p>\u4eca\u65e5\u306f\u3001Laravel5.6\u3067\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092cron\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u30d0\u30c3\u30c1\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u300cartisan\u300d\u3067\u30d0\u30c3\u30c1\u7528\u30b9\u30b1\u30eb\u30c8\u30f3\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>Laravel5.6\u3067\u3001\u30d0\u30c3\u30c1\u7528\u30b9\u30b1\u30eb\u30c8\u30f3\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u3001\u4e0b\u8a18\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \" >$ php artisan make:command [\u30af\u30e9\u30b9\u540d]<\/pre>\n<p>\u5b9f\u884c\u3055\u308c\u305f\u300cartisan\u300d\u30b3\u30de\u30f3\u30c9\u3067\u3001\u300c[\u30af\u30e9\u30b9\u540d]\u300d\u30d5\u30a1\u30a4\u30eb\u304c\u81ea\u52d5\u7684\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u300capp\/Console\/Commands\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \" >&lt;?php\r\nnamespace App\\Console\\Commands;\r\n\r\nuse Illuminate\\Console\\Command;\r\n\r\nclass [\u30af\u30e9\u30b9\u540d] extends Command\r\n{\r\n    \/**\r\n     * The name and signature of the console command.\r\n     *\r\n     * @var string\r\n     *\/\r\n    protected $signature = 'command:name';\r\n\r\n    \/**\r\n     * The console command description.\r\n     *\r\n     * @var string\r\n     *\/\r\n    protected $description = 'Command description';\r\n\r\n    \/**\r\n     * Create a new command instance.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function __construct()\r\n    {\r\n        parent::__construct();\r\n    }\r\n\r\n    \/**\r\n     * Execute the console command.\r\n     *\r\n     * @return mixed\r\n     *\/\r\n    public function handle()\r\n    {\r\n        \/\/\r\n    }\r\n}\r\n<\/pre>\n<p>\u3053\u308c\u3067\u3001\u96db\u5f62\u3068\u306a\u308b\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>\u300cartisan\u300d\u30b3\u30de\u30f3\u30c9\u3068\u3057\u3066\u767b\u9332\u3057\u3088\u3046<\/h2>\n<p>\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3060\u3051\u3067\u306f\u3001\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>Laravel\u306b\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u8a8d\u8b58\u3055\u305b\u308b\u305f\u3081\u306e\u767b\u9332\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u767b\u9332\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u300c<strong>app\/Console\/Kernel.php<\/strong>\u300d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \" >&lt;?php\r\n\r\nnamespace App\\Console;\r\n\r\nuse Egulias\\EmailValidator\\Exception\\CommaInDomain;\r\nuse Illuminate\\Console\\Scheduling\\Schedule;\r\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel;\r\n\r\nclass Kernel extends ConsoleKernel\r\n{\r\n    \/**\r\n     * The Artisan commands provided by your application.\r\n     *\r\n     * @var array\r\n     *\/\r\n    protected $commands = [\r\n    \tCommands\\[\u30af\u30e9\u30b9\u540d]::class,\r\n    ];<\/pre>\n<p>\u8ffd\u8a18\u5834\u6240\u306f\u3001\u914d\u5217\u300c<strong>$commands<\/strong>\u300d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u5185\u3067\u306e\u5b9f\u884c\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b9\u30b1\u30eb\u30c8\u30f3\u30d5\u30a1\u30a4\u30eb\u3092\u8a2d\u5b9a\u3057\u3088\u3046<\/h2>\n<p>\u30b9\u30b1\u30eb\u30c8\u30f3\u30d5\u30a1\u30a4\u30eb\u306b\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u524d\u306b\u521d\u671f\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u5b9f\u884c\u30b3\u30de\u30f3\u30c9\u3092\u5b9a\u7fa9\u3059\u308b<\/h3>\n<p>Laravel\u306e\u300cartisan\u300d\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u969b\u306b\u5fc5\u8981\u3068\u306a\u308b\u8b58\u5225\u5b50\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<p>\u8a2d\u5b9a\u306f\u3001\u300cprotected $signature\u300d\u306b\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u521d\u671f\u5024\u306f\u300c<strong>command:name<\/strong>\u300d\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3068\u3057\u3066\u3001\u300cset:test_cron\u300d\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \" >protected $signature = 'set:test_cron';<\/pre>\n<h4>\u30b3\u30ed\u30f3\u533a\u5207\u308a\u3067\u30b0\u30eb\u30fc\u30d4\u30f3\u30b0<\/h4>\n<p>\u300c$signature\u300d\u3067\u306f\u300c\u30b3\u30ed\u30f3\u300d\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001<strong>\u30b0\u30eb\u30fc\u30d4\u30f3\u30b0<\/strong>\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u8907\u6570\u306e\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u7ba1\u7406\u3059\u308b\u969b\u306b\u3001\u30b0\u30eb\u30fc\u30d4\u30f3\u30b0\u304c\u6d3b\u8e8d\u3057\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u300c\u30b3\u30ed\u30f3\u300d\u3092\u5229\u7528\uff08\u30b0\u30eb\u30fc\u30d4\u30f3\u30b0\uff09\u3057\u306a\u3044\u8a18\u8ff0\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h3>\u30b3\u30de\u30f3\u30c9\u306e\u8aac\u660e\u6587\u3092\u66f8\u3053\u3046<\/h3>\n<p>\u5909\u6570\u300c$description\u300d\u306b\u306f\u3001\u30b3\u30de\u30f3\u30c9\u306e\u8aac\u660e\u6587\uff08description\uff09\u3092\u8a18\u5165\u3059\u308b\u3053\u3068\u3092\u7ba1\u7406\u3057\u3084\u3059\u304f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u8a2d\u5b9a\u306e\u4ed5\u65b9\u306f\u4e0b\u8a18\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \" >protected $description = \"\u8aac\u660e\u6587\u8aac\u660e\u6587\u8aac\u660e\u6587\u8aac\u660e\u6587\";<\/pre>\n<p>\u8aac\u660e\u6587\u306f\u3001\u300c<strong>php artisan list<\/strong>\u300d\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \" >$ php artisan list\r\nset:\r\n  set:test_cron                   \u8aac\u660e\u6587\u8aac\u660e\u6587\u8aac\u660e\u6587\u8aac\u660e\u6587<\/pre>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u4fdd\u5b88\u30fb\u904b\u7528\u3092\u8003\u3048\u308b\u3068\u3001\u8aac\u660e\u6587\u304c\u3042\u308b\u65b9\u304c\u8ff7\u308f\u305a\u4fdd\u5b88\u30fb\u904b\u7528\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u3001\u7a4d\u6975\u7684\u306b\u6d3b\u7528\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u306d\u3002<\/p>\n<h2>\u5b9f\u969b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u300chandle\u300d\u5185\u306b\u8a18\u8ff0\u3057\u3088\u3046<\/h2>\n<p>\u3053\u3053\u307e\u3067\u304c\u3001Laravel\u3067\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u6e96\u5099\u3067\u3057\u305f\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306a\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u300c<strong>handle<\/strong>\u300d\u30e1\u30bd\u30c3\u30c9\u5185\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p>\u8a18\u8ff0\u304c\u7d42\u308f\u308c\u3070\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u306e\u5b8c\u6210\u3067\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u3001cron\u3067\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3055\u305b\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true \" >php artisan set:test_cron<\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Laravel\u3092\u5229\u7528\u3057\u3066\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u3082\u7c21\u5358\u306b\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u4ed6\u306b\u3082\u3001\u5f15\u6570\u3092\u5229\u7528\u3057\u305f\u65b9\u6cd5\u3084\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u5229\u7528\u3057\u305f\u65b9\u6cd5\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u6539\u3081\u3066\u3054\u7d39\u4ecb\u3067\u304d\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>\u73fe\u5834\u306e\u696d\u52d9\u30d5\u30ed\u30fc\u306b\u5bc4\u308a\u6dfb\u3063\u305fWeb\u30b7\u30b9\u30c6\u30e0\u3092\u304a\u6c42\u3081\u306a\u3089\u3001\u79c1\u305f\u3061ALAKI\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/h3>\n<p>ALAKI\u306f\u7d4c\u55b6\u8005\u69d8\u304c\u611f\u3058\u3066\u3044\u308b\u554f\u984c\u70b9\u3068\u3001\u5b9f\u969b\u306bWeb\u30b7\u30b9\u30c6\u30e0\u3092\u5229\u7528\u3055\u308c\u308b\u73fe\u5834\u30b9\u30bf\u30c3\u30d5\u69d8\u304c\u76f4\u9762\u3057\u3066\u3044\u308b\u8ab2\u984c\u3092\u3001\u5f0a\u793e\u30b7\u30b9\u30c6\u30e0\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u4e01\u5be7\u306b\u805e\u304d\u53d6\u308a\u3001\u304a\u5ba2\u69d8\u3068\u5171\u306b\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u308a\u4e0a\u3052\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u696d\u52d9\u6539\u5584\u304c\u5b9f\u73fe\u3067\u304d\u308bWeb\u30b7\u30b9\u30c6\u30e0\u3092\u304a\u6c42\u3081\u306e\u65b9\u306f\u3001\u662f\u975eALAKI\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/alaki.co.jp\/websystem\/\">\u30fbALAKI\u306eWeb\u30b7\u30b9\u30c6\u30e0\u958b\u767a<\/a><\/p>\n<p><a href=\"https:\/\/alaki.co.jp\/lp\/cloud-ordering-system\/\">\u30fbALAKI\u306e\u30af\u30e9\u30a6\u30c9\u578b\u53d7\u767a\u6ce8\u30b7\u30b9\u30c6\u30e0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002 \u4eca\u65e5\u306f\u3001Laravel5.&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":2927,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2955"}],"collection":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2955"}],"version-history":[{"count":5,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2955\/revisions"}],"predecessor-version":[{"id":4050,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2955\/revisions\/4050"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/2927"}],"wp:attachment":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2955"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}