这是我的index.blade.php
Point Point::operator%( double angle)
{
double rad=angle * PI / 180.0;
double s = sin(rad);
double c = cos(rad);
// rotate point
return Point(this->x * c - this->y * s,
this->x * s + this->y * c);
}
答案 0 :(得分:2)
在帖子模型中添加以下内容:
public function getWriterAvatarAttribute(){
try {
return User::findOrFail($this->user_id)->photo->file;
} catch (ModelNotFoundException $e){
return 'http://placehold.it/100x100';
}
}
并在视野范围内:
<img src="{{$post->writer_avatar}}" alt="user image">
答案 1 :(得分:0)
像这样使用:
<img src={{$user->photo ? $user->photo->file : 'http://placehold.it/100x100'}}" alt="user image">