From 79908e75ebe4a01b14f271962605a3363079daa4 Mon Sep 17 00:00:00 2001 From: Troels Liebe Bentsen Date: Wed, 15 Oct 2014 01:50:03 +0200 Subject: [PATCH] Link project to client so we get some default when adding to an invoice --- app/database/migrations/2014_10_06_103529_add_timesheets.php | 1 + app/models/Client.php | 5 +++++ app/models/Project.php | 5 +++++ 3 files changed, 11 insertions(+) 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');