0
My view does not have the data sent by the user
Controller
$posts = Models::post()->with('user')
->where('chatter_discussion_id', '=', $discussion->id)
->orderBy('created_at', 'ASC')
->paginate(10);
return view('chatter::discussion', compact('discussion', 'posts', 'corretor'));
Model
class Post extends Model
{
protected $table = 'chatter_post';
public $timestamps = true;
protected $fillable = ['chatter_discussion_id', 'user_id', 'body'];
public function discussion()
{
return $this->belongsTo(Models::className(Discussion::class),
'chatter_discussion_id');
}
View
@foreach($posts as $post)
//post->user nao tem nada é null
Come on, bro:
Models::className(Discussion::class)
?– novic