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

質問編集履歴

1

追記

2023/09/15 06:22

投稿

student
student

スコア87

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,44 @@
7
7
  決済機能を作成しています。
8
8
  決済に関する情報をしまっておく決済テーブルが必要だと思い、決済テーブルのマイグレーションファイルを作成しました。
9
9
 
10
+ ### 決済のテーブル
11
+ ```
12
+ <?php
10
13
 
14
+ use Illuminate\Database\Migrations\Migration;
15
+ use Illuminate\Database\Schema\Blueprint;
16
+ use Illuminate\Support\Facades\Schema;
17
+
18
+ return new class extends Migration
19
+ {
20
+ /**
21
+ * Run the migrations.
22
+ */
23
+ public function up(): void
24
+ {
25
+ Schema::create('payments', function (Blueprint $table) {
26
+ $table->id();
27
+ $table->unsignedBigInteger('post_id')->constrained(); //購入する商品のid
28
+ //ここにpayment_method_id(決済に使用するトークン / 決済後の顧客id)
29
+     //payment_is_finished(決済が完了したかどうか判別)
30
+ $table->timestamps();
31
+ });
32
+ }
33
+
34
+ /**
35
+ * Reverse the migrations.
36
+ */
37
+ public function down(): void
38
+ {
39
+ Schema::dropIfExists('payments');
40
+ }
41
+ };
42
+
43
+ ```
44
+ ### 聞きたい事
45
+ payment_method_idはstripeでは、トークンを入れるのでしょうか?
46
+ また。決済テーブルにuser_idを入れなくていいのでしょうか?
47
+
11
48
  ### 試したこと
12
49
  決済機能について検索を掛けて調べていたところ、主に下記のサイトがヒットしたのですが、
13
50
  テーブルの内容までを書いてあるところが少ないので、質問させて頂きました。