前提・実現したいこと
DB自体のリレーションは以下の通りできているのですが
モデル内の関数が動きません
該当のソースコード
Post.php
php
1<?php 2 3namespace App; 4 5use Illuminate\Database\Eloquent\Model; 6 7class Post extends Model 8{ 9 10 protected $fillable = [ 11 'u_id', 'comment', 12 ]; 13 14 public function user() 15 { 16 return $this->belongsTo('App\User'); 17 } 18 19 public function photos() 20 { 21 return $this->hasMany('App\Photo'); 22 } 23} 24
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/03/06 16:45