Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @foreach($authUser->reviews as $review)
- <p>{{ $review->body }} - {{$review->from_user }}</p>
- @endforeach
- class User extends Model implements AuthenticatableContract,
- AuthorizableContract,
- CanResetPasswordContract
- {
- use Authenticatable, Authorizable, CanResetPassword, Messagable;
- protected $table = 'users';
- protected $fillable = ['name', 'email', 'password', 'firstname', 'lastname', 'straat', 'postcode', 'plaats', 'provincie', 'role', 'specialisatie'];
- protected $hidden = ['password', 'remember_token'];
- public function projects()
- {
- return $this->hasMany('AppProject');
- }
- public function reviews()
- {
- return $this->hasMany('AppReview');
- }
- public function comments()
- {
- return $this->hasMany('AppComment');
- }
- }
- <?php
- namespace App;
- use IlluminateDatabaseEloquentModel;
- class Review extends Model
- {
- protected $guarded = [];
- protected $table = 'reviews';
- public function User()
- {
- return $this->belongsTo('AppUser');
- }
- }
- <?php
- namespace App;
- use IlluminateDatabaseEloquentModel;
- class Review extends Model
- {
- protected $guarded = [];
- protected $table = 'reviews';
- public function user()
- {
- return $this->belongsTo('AppUser', 'from_user');
- }
- }
- @foreach($authUser->reviews as $review)
- <p>{{ $review->body }} - {{ $review->user->name }}</p>
- @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement