Closed Gavrisimo closed 7 years ago
Show the source to the Vessel
class please.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class Vessel extends Model
{
use Notifiable;
protected $table = 'vessels';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'team_plan_id',
'is_active',
];
/**
* Route notifications for the mail channel.
*
* @return string
*/
public function routeNotificationForMail()
{
return $this->emails->first()->email;
}
public function owner()
{
return $this->belongsTo(User::class);
}
public function contacts()
{
return $this->hasMany(Contact::class, 'vessel_id');
}
public function disclosures()
{
return $this->morphMany(Disclosure::class, 'disclosurable');
}
public function employees()
{
return $this->hasMany(VesselEmployee::class);
}
public function images()
{
return $this->morphMany(Image::class, 'imagable');
}
public function campaigns()
{
return $this->hasMany(Campaign::class);
}
public function addresses()
{
return $this->morphMany(Address::class, 'addressable');
}
public function emails()
{
return $this->morphMany(Email::class, 'emailable');
}
public function phones()
{
return $this->morphMany(Phone::class, 'phoneable');
}
public function websites()
{
return $this->morphMany(Website::class, 'websiteable');
}
public function networks()
{
return $this->morphMany(Network::class, 'networkable');
}
public function activities()
{
return $this->morphMany(Activity::class, 'activatable');
}
public function audiences()
{
return $this->hasMany(Audience::class);
}
public function team_plan()
{
return $this->belongsTo(TeamPlan::class);
}
}
Hey @Gavrisimo!
Please be conscious that when you open an issue on this repo, 2000+ people get an email about it 😬
Happy to try and help but I think somewhere like the Laracasts forum is a better place for general testing questions like this, vs. specific questions about something in the course.
If you don't mind reposting the question over there, I'm happy to jump in and see if I can figure it out 👍🏻
Sorry everyone... =D
I'm just heavily into this course these days and this was bugging me for quite some time now, so I just thought to try and get some help here. 🐑
I did open laracasts thread, if someone can jump in and help I'd be super grateful:
https://laracasts.com/discuss/channels/testing/using-collections-in-testing
👍
Here is my test:
Basically I have no idea what is going on with that
$vessel->emails
not working... :(Any idea?
My
TestCase
that every test is extending is this: