Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel parent child same table

    public function parent()
    {
        return $this->belongsTo('AppCourseModule','parent_id')->where('parent_id',0);
    }

    public function children()
    {
        return $this->hasMany('AppCourseModule','parent_id');
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #parent #child #table
ADD COMMENT
Topic
Name
2+9 =