Link project to client so we get some default when adding to an invoice

This commit is contained in:
Troels Liebe Bentsen 2014-10-15 01:50:03 +02:00
parent acd5b7118e
commit 79908e75eb
3 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class AddTimesheets extends Migration {
$t->increments('id'); $t->increments('id');
$t->unsignedInteger('user_id'); $t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index(); $t->unsignedInteger('account_id')->index();
$t->unsignedInteger('client_id')->nullable();
$t->timestamps(); $t->timestamps();
$t->softDeletes(); $t->softDeletes();

View File

@ -32,6 +32,11 @@ class Client extends EntityModel
return $this->hasMany('Contact'); return $this->hasMany('Contact');
} }
public function projects()
{
return $this->hasMany('Project');
}
public function country() public function country()
{ {
return $this->belongsTo('Country'); return $this->belongsTo('Country');

View File

@ -15,6 +15,11 @@ class Project extends Eloquent
return $this->belongsTo('User'); return $this->belongsTo('User');
} }
public function client()
{
return $this->belongsTo('Client');
}
public function codes() public function codes()
{ {
return $this->hasMany('ProjectCode'); return $this->hasMany('ProjectCode');