From 107571ecfd0e634a797fad1eb858ba235ebe5c12 Mon Sep 17 00:00:00 2001 From: Alexandr Kosarev Date: Mon, 10 Sep 2018 22:21:11 +0300 Subject: [PATCH] link Ideas and Projects one to another --- admin/Model/Idea.php | 5 +++++ admin/Model/Project.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/admin/Model/Idea.php b/admin/Model/Idea.php index d8820d5..f270ade 100644 --- a/admin/Model/Idea.php +++ b/admin/Model/Idea.php @@ -11,4 +11,9 @@ class Idea extends Model { protected $fillable = ['title', 'description', 'project_id']; + + public function project() + { + return $this->belongsTo(Project::class); + } } \ No newline at end of file diff --git a/admin/Model/Project.php b/admin/Model/Project.php index e05745d..da3105b 100644 --- a/admin/Model/Project.php +++ b/admin/Model/Project.php @@ -11,4 +11,9 @@ class Project extends Model { protected $fillable = ['title', 'description']; + + public function ideas() + { + return $this->hasMany(Idea::class); + } } \ No newline at end of file