From e0dd2ef9095b20f6d67020db66e358c43b6033f3 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 1 Dec 2014 12:21:44 +0000 Subject: [PATCH] Rename component.component to component_id with relationship name change --- ...terTableIncidentsRenameComponentColumn.php | 34 +++++++++++++++++++ app/models/Incident.php | 14 ++++---- 2 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 app/database/migrations/2014_12_01_121947_AlterTableIncidentsRenameComponentColumn.php diff --git a/app/database/migrations/2014_12_01_121947_AlterTableIncidentsRenameComponentColumn.php b/app/database/migrations/2014_12_01_121947_AlterTableIncidentsRenameComponentColumn.php new file mode 100644 index 00000000..22a1975c --- /dev/null +++ b/app/database/migrations/2014_12_01_121947_AlterTableIncidentsRenameComponentColumn.php @@ -0,0 +1,34 @@ + 'required|integer', - 'component' => 'required|integer', - 'name' => 'required', - 'status' => 'required|integer', - 'message' => 'required', + 'user_id' => 'required|integer', + 'component_id' => 'required|integer', + 'name' => 'required', + 'status' => 'required|integer', + 'message' => 'required', ]; protected $fillable = ['component', 'name', 'status', 'message']; @@ -23,8 +23,8 @@ class Incident extends Eloquent implements \Dingo\Api\Transformer\TransformableI * An incident belongs to a component. * @return Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function parent() { - return $this->belongsTo('Component', 'component', 'id'); + public function component() { + return $this->belongsTo('Component', 'component_id', 'id'); } /**