File: /home/bishwesh/internstolearn.com/app/User.php
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Models\Profile;
use App\Models\Internship;
class User extends \TCG\Voyager\Models\User implements MustVerifyEmail
{
use Notifiable;
protected $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'user_type'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
//user has one profile
public function profile()
{
return $this->hasOne(Profile::class);
}
/**
* Many to many relationship with internships
*/
public function internships()
{
return $this->belongsToMany(Internship::class);
}
/**
* Many to many relationshipt with events
*/
public function events()
{
return $this->belongsToMany('App\Models\Event');
}
//user has one profile
public function company()
{
return $this->hasOne(Models\Company::class);
}
}