質問するログイン新規登録

質問編集履歴

2

タグ

2020/08/16 07:08

投稿

mizuneko_4345
mizuneko_4345

スコア4

title CHANGED
File without changes
body CHANGED
File without changes

1

ひとまず応急措置

2020/08/16 07:07

投稿

mizuneko_4345
mizuneko_4345

スコア4

title CHANGED
@@ -1,1 +1,1 @@
1
- php artisan test_commandターミナル上に不可解エラーが出る
1
+ Laravelのバッチ作成が
body CHANGED
@@ -1,9 +1,74 @@
1
- ### 前提・実現したいこと
1
+ ### 実現したいこと
2
2
  Laravelでバッチ作成
3
3
 
4
+ ### 前提
5
+ AWSのEC2上で無料枠のCentOS7を選択し(ストレージを30GiB)インスタンスを作成しました。
6
+ 次に、MySQL,Nginx,PHP,Laravelをそれぞれインストールしました。バージョンは以下です。
7
+
8
+ mysqld Ver 5.7.31 for Linux on x86_64
9
+ nginx/1.18.0
4
- MySQLでDBを作成後、
10
+ PHP 7.3.20
11
+ Laravel7
12
+
13
+ その後VSCodeのRemoteSSH機能を使って、サーバ側にWindows経由でSSH接続しました。
14
+
15
+
5
- VSCodeでホストサーバにアクセスし、TestCommand.php内部を編集しました。
16
+ MySQLでDBを作成後、VSCodeでホストサーバにアクセスし、TestCommand.php内部を編集しました。
17
+ ```
18
+ 【TestCommand.php】
19
+
20
+ <?php
21
+
22
+ namespace App\Console\Commands;
23
+
24
+ use Illuminate\Console\Command;
25
+ use App\Models\Player;
26
+
27
+ class TestCommand extends Command
28
+ {
29
+ /**
30
+ * The name and signature of the console command.
31
+ *
32
+ * @var string
33
+ */
34
+ protected $signature = 'test_command';
35
+
36
+ /**
37
+ * The console command description.
38
+ *
39
+ * @var string
40
+ */
41
+ protected $description = 'Test Command';
42
+
43
+ /**
44
+ * Create a new command instance.
45
+ *
46
+ * @return void
47
+ */
48
+ public function __construct()
49
+ {
50
+ parent::__construct();
51
+ }
52
+
53
+ /**
54
+ * Execute the console command.
55
+ *
56
+ * @return int
57
+ */
58
+ public function handle()
59
+ {
60
+ $players = Player::get();
61
+ foreach($players as $player) {
62
+ echo $player->name."\n";
63
+ }
64
+ return 0;
65
+ }
66
+ }
67
+ ```
68
+
69
+
6
- php artisan test_commandでDB上のサッカー選手名表示させたいのすが
70
+ php artisan test_commandをターミナル上打ち込み
71
+ DB上のサッカー選手名を表示させたいのですが、
7
72
  以下のエラーが表示されます。
8
73
 
9
74
  ### 発生している問題・エラーメッセージ1