質問編集履歴
3
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,6 +25,8 @@
|
|
25
25
|
.id
|
26
26
|
|
27
27
|
|
28
|
+
|
29
|
+
#### モデル、マイグレーション
|
28
30
|
|
29
31
|
```
|
30
32
|
|
@@ -58,6 +60,8 @@
|
|
58
60
|
|
59
61
|
[Blogマイグレーション ]
|
60
62
|
|
63
|
+
|
64
|
+
|
61
65
|
public function up()
|
62
66
|
|
63
67
|
{
|
@@ -85,6 +89,8 @@
|
|
85
89
|
|
86
90
|
|
87
91
|
[skillマイグレーション ]
|
92
|
+
|
93
|
+
|
88
94
|
|
89
95
|
public function up()
|
90
96
|
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -23,6 +23,94 @@
|
|
23
23
|
.content
|
24
24
|
|
25
25
|
.id
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
[Blog_php]
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
public function blogSkills()
|
36
|
+
|
37
|
+
{
|
38
|
+
|
39
|
+
return $this->hasMany(BlogSkill::class, 'blog_id');
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
[skill.php]
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
public function blogSkills()
|
50
|
+
|
51
|
+
{
|
52
|
+
|
53
|
+
return $this->hasMany(BlogSkill::class, 'skill_id');
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
[Blogマイグレーション ]
|
60
|
+
|
61
|
+
public function up()
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
Schema::create('blogs', function(Blueprint $table)
|
66
|
+
|
67
|
+
{
|
68
|
+
|
69
|
+
$table->integer('id', true);
|
70
|
+
|
71
|
+
$table->string('content', 200);
|
72
|
+
|
73
|
+
$table->boolean('status');
|
74
|
+
|
75
|
+
$table->dateTime('published_at')->nullable();
|
76
|
+
|
77
|
+
$table->timestamps();
|
78
|
+
|
79
|
+
$table->softDeletes();
|
80
|
+
|
81
|
+
});
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
[skillマイグレーション ]
|
88
|
+
|
89
|
+
public function up()
|
90
|
+
|
91
|
+
{
|
92
|
+
|
93
|
+
Schema::create('skills', function(Blueprint $table)
|
94
|
+
|
95
|
+
{
|
96
|
+
|
97
|
+
$table->integer('id', true);
|
98
|
+
|
99
|
+
$table->string('skill_name', 50)->unique('skill_name');
|
100
|
+
|
101
|
+
$table->boolean('status');
|
102
|
+
|
103
|
+
$table->timestamps();
|
104
|
+
|
105
|
+
$table->softDeletes();
|
106
|
+
|
107
|
+
});
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
|
26
114
|
|
27
115
|
|
28
116
|
|
1
誤字
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Lar
|
1
|
+
Laravel Eloquentリレーション先の結果によってデータを取得する。
|
test
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
-
```Lara
|
57
|
+
```Laravel
|
58
58
|
|
59
59
|
Blog::whereHas('blogSkills', function($query){
|
60
60
|
|