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

質問編集履歴

1

Modelクラス追加しました。

2019/05/01 15:46

投稿

Lab-art_Yamada
Lab-art_Yamada

スコア14

title CHANGED
File without changes
body CHANGED
@@ -114,5 +114,97 @@
114
114
 
115
115
  ```
116
116
 
117
+ ```User
118
+ <?php
119
+
120
+ namespace App;
121
+
122
+ use Illuminate\Notifications\Notifiable;
123
+ use Illuminate\Contracts\Auth\MustVerifyEmail;
124
+ use Illuminate\Foundation\Auth\User as Authenticatable;
125
+ use App\Notifications\JaPasswordReset;
126
+ use App\Http\Model\Chapter;
127
+ use App\Http\Model\Visitor;
128
+
129
+ class User extends Authenticatable
130
+ {
131
+ use Notifiable;
132
+
133
+ /**
134
+ * The attributes that are mass assignable.
135
+ *
136
+ * @var array
137
+ */
138
+ protected $fillable = [
139
+ 'chapter_id','name01','name02','kana01','kana02','company','category','base_comment', 'email', 'password','role'
140
+ ];
141
+
142
+ /**
143
+ * The attributes that should be hidden for arrays.
144
+ *
145
+ * @var array
146
+ */
147
+ protected $hidden = [
148
+ 'password', 'remember_token',
149
+ ];
150
+
151
+
152
+ public function visitor()
153
+ {
154
+ return $this->hasMany('App\Model\Visitor' , 'member_id' , 'id');
155
+ }
156
+
157
+ public function sendPasswordResetNotification($token)
158
+ {
159
+ $this->notify(new JaPasswordReset($token));
160
+ }
161
+ }
162
+ ```
163
+ ```Visitor
164
+ <?php
165
+
166
+ namespace App\Http\Model;
167
+
168
+ use Illuminate\Database\Eloquent\Model;
169
+ use Illuminate\Notifications\Notifiable;
170
+
171
+ class Visitor extends Model
172
+ {
173
+
174
+ use Notifiable;
175
+
176
+
177
+ protected $table = 'visitors';
178
+
179
+ /**
180
+ * The attributes that are mass assignable.
181
+ *
182
+ * @var array
183
+ */
184
+ protected $fillable = [
185
+ 'visit','company','name01','name02','kana01','kana02','category','member_id','member_name','comment', 'status'
186
+ ];
187
+
188
+ /**
189
+ * The attributes that should be hidden for arrays.
190
+ *
191
+ * @var array
192
+ */
193
+ protected $hidden = [
194
+ 'password', 'remember_token',
195
+ ];
196
+
197
+
198
+ public function user()
199
+ {
200
+ return $this->belongsTo('App\User','member_id');
201
+ }
202
+
203
+
204
+ }
205
+
206
+ ```
207
+
208
+
117
209
  どの辺りに問題がありそうでしょうか?
118
210
  その他、確認が必要なクラスがあれば追記させて頂きます。