Skip to content

Commit

Permalink
link Ideas and Projects one to another
Browse files Browse the repository at this point in the history
  • Loading branch information
alex7r committed Sep 10, 2018
1 parent d37cd29 commit 107571e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions admin/Model/Idea.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
class Idea extends Model
{
protected $fillable = ['title', 'description', 'project_id'];

public function project()
{
return $this->belongsTo(Project::class);
}
}
5 changes: 5 additions & 0 deletions admin/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
class Project extends Model
{
protected $fillable = ['title', 'description'];

public function ideas()
{
return $this->hasMany(Idea::class);
}
}

0 comments on commit 107571e

Please sign in to comment.