You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
880 B
42 lines
880 B
<?php
|
|
|
|
namespace App\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Project extends Model
|
|
{
|
|
protected $fillable = [
|
|
'id',
|
|
'name',
|
|
'description',
|
|
'user_id',
|
|
'company_id',
|
|
'days',
|
|
];
|
|
|
|
protected function user()
|
|
{
|
|
return $this->belongsToMany('App\Model\User');
|
|
}
|
|
|
|
public function company()
|
|
{
|
|
return $this->belongsTo('App\Model\Company');
|
|
}
|
|
|
|
public function comments()
|
|
{
|
|
return $this->morphMany('App\Model\Comment', 'commentable');
|
|
}
|
|
|
|
public function users()
|
|
{
|
|
return $this->belongsToMany('App\Model\User','project_users')
|
|
->withPivot('id','created_at');
|
|
//->withTimestamps()
|
|
//->as('subscription');
|
|
//return $this->belongsToMany('App\User', 'project_user', 'project_id','user_id')->withPivot('id');
|
|
}
|
|
}
|