diff --git a/app/database/migrations/2014_10_06_103529_add_timesheets.php b/app/database/migrations/2014_10_06_103529_add_timesheets.php index 2cd4a79f26f6..22d0f117cfed 100644 --- a/app/database/migrations/2014_10_06_103529_add_timesheets.php +++ b/app/database/migrations/2014_10_06_103529_add_timesheets.php @@ -16,6 +16,7 @@ class AddTimesheets extends Migration { $t->increments('id'); $t->unsignedInteger('user_id'); $t->unsignedInteger('account_id')->index(); + $t->unsignedInteger('client_id')->nullable(); $t->timestamps(); $t->softDeletes(); diff --git a/app/models/Client.php b/app/models/Client.php index b3db158f76ae..f87e9aeda62a 100755 --- a/app/models/Client.php +++ b/app/models/Client.php @@ -31,6 +31,11 @@ class Client extends EntityModel { return $this->hasMany('Contact'); } + + public function projects() + { + return $this->hasMany('Project'); + } public function country() { diff --git a/app/models/Project.php b/app/models/Project.php index 0c3da75abc9a..9960dd0e82ee 100644 --- a/app/models/Project.php +++ b/app/models/Project.php @@ -15,6 +15,11 @@ class Project extends Eloquent return $this->belongsTo('User'); } + public function client() + { + return $this->belongsTo('Client'); + } + public function codes() { return $this->hasMany('ProjectCode');