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

質問編集履歴

5

誤字

2020/10/16 06:46

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -53,7 +53,6 @@
53
53
 
54
54
  ```
55
55
  ####テーブル構成
56
- ```
57
56
  cast_site テーブル
58
57
  |id|cast_id|site_id|site_email|
59
58
  |:--|:--:|--:|
@@ -68,7 +67,7 @@
68
67
  |id|site_name|site_url|
69
68
  |:--|:--:|--:|
70
69
  ||||
71
- ```
70
+
72
71
  #####試したこと
73
72
  ```ここに言語を入力
74
73
  foreach ($cast as $data) {

4

cast php 追記

2020/10/16 06:46

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -31,6 +31,27 @@
31
31
  return redirect()->route('cast.index');
32
32
  }
33
33
  ```
34
+ cast php
35
+ ```ここに言語を入力
36
+ <?php
37
+
38
+ namespace App\Models;
39
+
40
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
41
+ use Illuminate\Database\Eloquent\Model;
42
+
43
+ class Cast extends Model
44
+ {
45
+ use HasFactory;
46
+ protected $table = 'casts';
47
+
48
+ public function sites()
49
+ {
50
+ return $this->belongsToMany('App\Models\Site');
51
+ }
52
+ }
53
+
54
+ ```
34
55
  ####テーブル構成
35
56
  ```
36
57
  cast_site テーブル

3

誤字

2020/10/16 06:17

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -47,7 +47,7 @@
47
47
  |id|site_name|site_url|
48
48
  |:--|:--:|--:|
49
49
  ||||
50
-
50
+ ```
51
51
  #####試したこと
52
52
  ```ここに言語を入力
53
53
  foreach ($cast as $data) {

2

テーブル構成追加

2020/10/16 05:36

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -31,7 +31,23 @@
31
31
  return redirect()->route('cast.index');
32
32
  }
33
33
  ```
34
+ ####テーブル構成
35
+ ```
36
+ cast_site テーブル
37
+ |id|cast_id|site_id|site_email|
38
+ |:--|:--:|--:|
39
+ ||||
34
40
 
41
+ casts テーブル
42
+ |id|cast_name|cast_password|
43
+ |:--|:--:|--:|
44
+ ||||
45
+
46
+ sites テーブル
47
+ |id|site_name|site_url|
48
+ |:--|:--:|--:|
49
+ ||||
50
+
35
51
  #####試したこと
36
52
  ```ここに言語を入力
37
53
  foreach ($cast as $data) {

1

追記

2020/10/16 05:35

投稿

pup-ganbaru
pup-ganbaru

スコア29

title CHANGED
File without changes
body CHANGED
@@ -32,4 +32,12 @@
32
32
  }
33
33
  ```
34
34
 
35
+ #####試したこと
36
+ ```ここに言語を入力
37
+ foreach ($cast as $data) {
38
+ $data->site_email = $request->site_email;
39
+ }
40
+ ```
41
+ このようにもしてみましたがsite_emailなんてないよと言われてしまいます。
42
+
35
43
  以上になります。もし解決策、改善点などあれば、ご教示いただけると幸いです。